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
on 2013-01-02 17:57
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.