Skip to content

Instantly share code, notes, and snippets.

@MrJaba
Created April 25, 2012 19:33
Show Gist options
  • Save MrJaba/2492612 to your computer and use it in GitHub Desktop.
Save MrJaba/2492612 to your computer and use it in GitHub Desktop.
JRuby oddness?
# jruby 1.6.7 (ruby-1.9.2-p312)
require 'open-uri'
a = open("http://pinterest.com/pin/56295064062363076/").read
a.encoding
=> #<Encoding:UTF-8>
b = StringIO.new(a).read
b.encoding
=> #<Encoding:ASCII-8BIT>
Encoding.default_internal
=> nil
Encoding.default_external
=> #<Encoding:UTF-8>
# ruby 1.9.3p194 (2012-04-20 revision 35410)
require 'open-uri'
a = open("http://pinterest.com/pin/56295064062363076/").read
a.encoding
=> #<Encoding:UTF-8>
b = StringIO.new(a).read
b.encoding
=> #<Encoding:UTF-8>
Encoding.default_internal
=> nil
Encoding.default_external
=> #<Encoding:UTF-8>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment