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

Literal `\あ` results in invalid multibyte char error #1390

Closed
BanzaiMan opened this Issue Jan 10, 2014 · 7 comments

Comments

Projects
None yet
4 participants
@BanzaiMan
Copy link
Member

commented Jan 10, 2014

As reported in https://twitter.com/y_shindoh/status/421425572284465152.

test.rb

puts '\\'
$ jruby -v --1.8 test.rb
jruby 1.7.9 (ruby-1.8.7p370) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [darwin-x86_64]
\あ
$ jruby -v --1.9 -E UTF-8 test.rb
jruby 1.7.9 (1.9.3p392) 2013-12-06 87b108a on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [darwin-x86_64]
SyntaxError: test.rb:2: invalid multibyte char (US-ASCII)
$ jruby -v -E UTF-8 test.rb
jruby 1.7.10 (1.9.3p392) 2014-01-09 6e79f55 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [darwin-x86_64]
SyntaxError: test.rb:2: invalid multibyte char (US-ASCII)

It works on (near) master in the default 2.1.0 mode.

@BanzaiMan

This comment has been minimized.

Copy link
Member Author

commented Jan 10, 2014

Looks like a parser problem.

$ jruby -v -Xbacktrace.style=raw -E UTF-8 test.rb
jruby 1.7.10 (1.9.3p392) 2014-01-09 6e79f55 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [darwin-x86_64]
SyntaxError: test.rb:2: invalid multibyte char (US-ASCII)
      getStackTrace at java/lang/Thread.java:1588
   getBacktraceData at org/jruby/runtime/backtrace/TraceType.java:175
       getBacktrace at org/jruby/runtime/backtrace/TraceType.java:39
   prepareBacktrace at org/jruby/RubyException.java:224
           preRaise at org/jruby/exceptions/RaiseException.java:213
           preRaise at org/jruby/exceptions/RaiseException.java:194
             <init> at org/jruby/exceptions/RaiseException.java:110
  newRaiseException at org/jruby/Ruby.java:3774
     newSyntaxError at org/jruby/Ruby.java:3575
              parse at org/jruby/parser/Parser.java:141
              parse at org/jruby/parser/Parser.java:95
  parseFileFromMain at org/jruby/Ruby.java:2573
      parseFromMain at org/jruby/Ruby.java:544
        runFromMain at org/jruby/Ruby.java:504
      doRunFromMain at org/jruby/Main.java:395
        internalRun at org/jruby/Main.java:290
                run at org/jruby/Main.java:217
               main at org/jruby/Main.java:197
@enebo

This comment has been minimized.

Copy link
Member

commented Jan 10, 2014

I think we might have another issue on this open but yours definitely seems to be like the smallest repro.

@k77ch7

This comment has been minimized.

Copy link
Contributor

commented Oct 15, 2014

Invalid multibyte char error is raised when using double quote string.

in JRuby 1.7.16

$ ruby -e "puts \"\\あ\”"
SyntaxError: -e:2: invalid multibyte char (UTF-8)

in MRI 1.9.3

$ ruby -e "puts \"\\あ\”"
あ
@headius

This comment has been minimized.

Copy link
Member

commented Nov 12, 2014

The first case works now, but the second case with double quotes still fails (ruby -e "puts \"\\あ\”")

@k77ch7

This comment has been minimized.

Copy link
Contributor

commented Nov 14, 2014

@headius sorry. It was my mistake.
Not Correct: ruby -e "puts "\あ\”"
Correct: ruby -e "puts "\あ""

The second case with with double quotes works on current jruby-1_7 branch(ruby -e "puts "\あ"").

@k77ch7

This comment has been minimized.

Copy link
Contributor

commented Feb 14, 2015

This works on current master(78e968e) and jruby-1_7(1c0f056). I think this can be closed.

@enebo enebo added this to the JRuby 1.7.20 milestone Feb 16, 2015

@enebo

This comment has been minimized.

Copy link
Member

commented Feb 16, 2015

Ok. Thanks for solving this on @k77ch7 !

@enebo enebo closed this Feb 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.