-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Description
Having some trouble with UTF-16LE encoded strings in jruby...
Tried the following in jruby-1.7.9:
>> a = 'ABC'.encode('UTF-16LE')
=> "ABC"
>> b = 'ABC'.encode('UTF-16LE')
=> "ABC"
>> b.casecmp(a)which produced:
Java::JavaLang::ArrayIndexOutOfBoundsException: -1
from org.jruby.RubyString.multiByteCasecmp(RubyString.java:1661)
from org.jruby.RubyString.casecmp19(RubyString.java:1636)
from org.jruby.RubyString$INVOKER$i$1$0$casecmp19.call(RubyString$INVOKER$i$1$0$casecmp19.gen)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
from org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
from org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
from org.jruby.ast.RootNode.interpret(RootNode.java:129)
from org.jruby.evaluator.ASTInterpreter.INTERPRET_EVAL(ASTInterpreter.java:95)
from org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:184)
from org.jruby.RubyKernel.evalCommon(RubyKernel.java:1156)
from org.jruby.RubyKernel.eval19(RubyKernel.java:1119)
from org.jruby.RubyKernel$INVOKER$s$0$3$eval19.call(RubyKernel$INVOKER$s$0$3$eval19.gen)
from org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:180)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70)
from org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60)
... 114 levels...
from org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
from org.jruby.evaluator.ASTInterpreter.INTERPRET_METHOD(ASTInterpreter.java:74)
from org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:182)
from org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:198)
from org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:326)
from org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
from from bin.irb.__file__(bin/irb:13)
from bin.irb.load(bin/irb)
from org.jruby.Ruby.runScript(Ruby.java:811)
from org.jruby.Ruby.runScript(Ruby.java:804)
from org.jruby.Ruby.runNormally(Ruby.java:673)
from org.jruby.Ruby.runFromMain(Ruby.java:522)
from org.jruby.Main.doRunFromMain(Main.java:395)
from org.jruby.Main.internalRun(Main.java:290)
from org.jruby.Main.run(Main.java:217)
from org.jruby.Main.main(Main.java:197)One thing I did notice is that org.jcodings.EncodingDB has an entry for 'UTF-16LE' but org.jcodings.EncodingList does not contain an entry for 'UTF-16LE'...
Am I doing something strange or is this an issue? I'll continue looking at what might be causing it but would like to know if anyone has seen this before.
Reactions are currently unavailable