Created
November 10, 2011 17:09
-
-
Save tehviking/1355431 to your computer and use it in GitHub Desktop.
JRuby in 1.9 UTF-8 breaks ERB: Java::JavaLang::ArrayIndexOutOfBoundsException in Default#index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#WORKS | |
# -*- coding: UTF-8 -*- | |
require 'erb' | |
template = ERB.new <<-EOF | |
<% 0.times do %> | |
<% end %> | |
☃ | |
EOF | |
puts template.result | |
#BREAKS | |
# -*- coding: UTF-8 -*- | |
require 'erubis' | |
template = Erubis::Eruby.new <<-EOF | |
<% 0.times do %> | |
<% end %> | |
☃ | |
EOF | |
puts template.result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java::JavaLang::ArrayIndexOutOfBoundsException in Default#index | |
Showing /Users/bjohnson/learn/jutf/app/views/default/index.html.erb where line # raised: | |
2 | |
Extracted source (around line #): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
☃ | |
<% 0.times do %> | |
<% end %> |
+1
I also got this bug, when I Set JRuby to run in 1.9 mode
@tom_enebo (on Twitter) fixed this for ERB renderer, but Erubis is still a problem. This breaks Rails 3 on 1.9, so it seems like it ought to be widespread for 1.9 mode. He says he's looking into this and should have a fix to test in the next week or so.
+1
Tom says he hasn't had time to look into this issue, but should soon. I'll post again if and when I hear this issue is ready for some testing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to relate to this issue, which has no assignee:
http://jira.codehaus.org/browse/JRUBY-6120
I should note this is in JRuby 1.6.5, and that removing the UTF-8 chars or the ERB code seems to bypass the issue.