Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Encoding::CompatibilityError] compiling multi-byte class name with --java option #4667

Open
jakago opened this issue Jun 14, 2017 · 0 comments

Comments

@jakago
Copy link

jakago commented Jun 14, 2017

blah.rb

# coding: utf-8

# 'α'.bytes => [206, 177]
class C_α
  p self.to_s.bytes
end

run with jruby 9.1.9.0

$ jruby blah.rb
[67, 95, 206, 177]

compile with --java

$ jrubyc --java blah.rb
Encoding::CompatibilityError: incompatible encodings: ASCII-8BIT and UTF-8
                          static_init at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler/java_class.rb:396
                                 to_s at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler/java_class.rb:492
  block in compile_files_with_options at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler.rb:155
                                 open at org/jruby/RubyIO.java:1156
  block in compile_files_with_options at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler.rb:154
                                 each at org/jruby/RubyArray.java:1734
  block in compile_files_with_options at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler.rb:144
  block in compile_files_with_options at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler.rb:297
                                 each at org/jruby/RubyArray.java:1734
           compile_files_with_options at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler.rb:281
                         compile_argv at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/lib/ruby/stdlib/jruby/compiler.rb:94
                               <main> at /Users/xxxxxx/.rbenv/versions/jruby-9.1.9.0/bin/jrubyc:5

compile without --java and run

$ jrubyc blah.rb
$ jruby blah.class
LoadError: blah.class is not compiled Ruby; use java_import to load normal classes

Environment

$ jruby -v
jruby 9.1.9.0 (2.3.3) 2017-05-15 28aa830 Java HotSpot(TM) 64-Bit Server VM 25.121-b13 on 1.8.0_121-b13 +jit [darwin-x86_64]
$ uname -a
Darwin mac-mini.local 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan  9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant