arton / rjb

Ruby Java Bridge
https://www.artonx.org/collabo/backyard/?RubyJavaBridge
GNU Lesser General Public License v2.1
117 stars 34 forks source link

Cannot use surrogate pair. #68

Closed tuchida closed 5 years ago

tuchida commented 5 years ago
Rjb.import('java.lang.System').out.println('𠮷野家')
// => ð ®

I want to use emoji in UTF-8. What should I do?

arton commented 5 years ago

Rjb 1.5.9 and below does not modify UTF-8 to CESU-8. https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/types.html#wp16542

I'll fix this issue.

arton commented 5 years ago

Hi tuchida Sorry for late response. I fixed this issue and pushed rjb-1.6.0.gem to rubygem.org. I added below test case and got green.


  def test_java_utf8
    y = @jString.new('𠮷野家')
    assert_equal '𠮷野家', y.toString
  end
tuchida commented 5 years ago

Thank you! I confirmed it work good.