Skip to content

Instantly share code, notes, and snippets.

@tehviking
Created November 10, 2011 17:09
Show Gist options
  • Save tehviking/1355431 to your computer and use it in GitHub Desktop.
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
#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
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 #):
<% 0.times do %>
<% end %>
@bkoc
Copy link

bkoc commented Nov 22, 2011

+1

@tehviking
Copy link
Author

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