Convert input to string before xml escaping

Fixes https://github.com/jekyll/jekyll/issues/2242.