I was trying to pass a non-ascii string to Ruby#evalScriptlet and receive an exception (invalid multibyte character (US-ASCII)). The same string can be successfully passed to Ruby#executeScript. Is this the expected behavior? Is there anything I can do to pass an encoded string to evalScriptlet? An example program at https://gist.github.com/4646746#file-jruby-evalscr... Thanks and Regards KD
on 2013-01-27 07:14
on 2013-01-28 17:36
executeScript is meant to simulate as if being called from a command-line. evalScriptlet is more for internal usage and assumes runtime instance has been setup with the environment you want. I recommend you do not use either of these (EmbedUtils is an older embedding option) and use RedBridge APIs: https://github.com/jruby/jruby/wiki/RedBridge This does all you want and more and it has a lot more documentation as well. -Tom On Sun, Jan 27, 2013 at 12:12 AM, Dakshinamurthy Karra <technovator@gmail.com> wrote: > Thanks and Regards > KD > -- blog: http://blog.enebo.com twitter: tom_enebo mail: tom.enebo@gmail.com
on 2013-01-28 17:49
Thanks for the suggestion. This code is part of a larger project and I prefer not changing it at this time. I implemented a workaround - before calling evalScriptlet converting the script to ascii. Still, I would like to know what is happening in this case. The interpreter has been setup the same way for both the calls to evalScriptlet and executeScript. -- KD
on 2013-01-28 18:23
If I had to guess I would say we pass into some config stuff when we start JRuby (like flags from the native launcher) the first time which is not reflected in the no-arg RubyInstanceConfig constructor (which your example ends up indirectly calling). In particular, I am guessing we defalt iso8859_1 encoding and you are expecting UTF-8. -Tom On Mon, Jan 28, 2013 at 10:48 AM, Dakshinamurthy Karra <technovator@gmail.com> wrote: > -- KD >> embedding option) and use RedBridge APIs: >> > I was trying to pass a non-ascii string to Ruby#evalScriptlet and >> > >> mail: tom.enebo@gmail.com >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> > -- blog: http://blog.enebo.com twitter: tom_enebo mail: tom.enebo@gmail.com
on 2013-01-28 19:28
The sample I posted is using the default configuration. In the actual project code, proper ruby configuration object is constructed (including the encoding) and passed to the the instance. Even in the sample, executeScript accepts encoded strings whereas evalScriptlet doesn't. I will walk through the evalScriptlet and see what is happening. -- KD
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.