changed how strings get encoding to better support JRuby (fixes #9)
Merge pull request #23 from rolfb/master

Better encoding support for JRuby