Skip to content

Instantly share code, notes, and snippets.

@tddium
Created June 4, 2012 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tddium/2869891 to your computer and use it in GitHub Desktop.
Save tddium/2869891 to your computer and use it in GitHub Desktop.
Ruby 1.9.3-p0 vs 1.9.3-p194 Encoding Madness
# encoding: UTF-8
opts = {:invalid => :replace, :undef => :replace, :replace => '', :newline => :universal}
s, b = 'ード', 'بلآ'
puts s.encoding.name
s.to_s.encode('UTF-8', opts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment