We are presently working on improving our UTF-8 support, and have had
some
problems getting it to work properly.
The following code prints a different result when run from the command
line
and when run from a Servlet (complete .java file available at
https://gist.github.com/4436025):
ScriptingContainer container = new
ScriptingContainer(LocalContextScope.SINGLETHREAD);
container.setCompatVersion(CompatVersion.RUBY1_9);
container.runScriptlet(“# encoding: utf-8\nputs ‘’”);
container.runScriptlet(“# encoding: utf-8\nputs
‘’.bytes.to_a.inspect”);
When run from the command line, the puts statements correctly print the
pi
character and [207, 128].
When run from within a Servlet, the puts statements print the ‘?’
character
and [63].
Anyone have any ideas as to why the code would behave differently in
these
to contexts?
Thanks,
Ben Christenson