Skip to content

Instantly share code, notes, and snippets.

@kdmurthy
Created January 27, 2013 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdmurthy/4646746 to your computer and use it in GitHub Desktop.
Save kdmurthy/4646746 to your computer and use it in GitHub Desktop.
JRuby evalScript does not accept non-ascii characters. Is this the way it should be?
package ruby.experiments;
import java.util.ArrayList;
import org.jruby.Ruby;
import org.jruby.javasupport.JavaEmbedUtils;
public class EvalScriptlet {
public static void main(String[] args) {
Ruby ruby = JavaEmbedUtils.initialize(new ArrayList<String>());
String script = "puts 'Hello World'";
ruby.executeScript(script, "<script>");
ruby.evalScriptlet(script);
String scriptUTF8 = "puts \"Árbol de demostración\"" ;
ruby.executeScript(scriptUTF8, "<script>");
ruby.evalScriptlet(scriptUTF8);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment