Fix parsing in JRuby
Fix encoding issues with text data