Skip to content

Instantly share code, notes, and snippets.

@rafacv
Created February 17, 2012 00:09
Show Gist options
  • Save rafacv/1849043 to your computer and use it in GitHub Desktop.
Save rafacv/1849043 to your computer and use it in GitHub Desktop.
IronRuby doesn't respect encoding comments when eval'ing
eval <<ENC
# coding: utf-8
def method
puts "".encoding.inspect
end
ENC
eval <<ENC
# coding: big5
def method2
puts "".encoding.inspect
end
ENC
eval <<ENC
# coding: shift_jis
def method3
puts "".encoding.inspect
end
ENC
method
method2
method3
$ ruby encoding.rb
#<Encoding:UTF-8>
#<Encoding:Big5>
#<Encoding:Shift_JIS>
$ ir encoding.rb
#<Encoding:US-ASCII>
#<Encoding:US-ASCII>
#<Encoding:US-ASCII>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment