added encoding support for JRuby