Skip to content

Instantly share code, notes, and snippets.

@charlie
Created February 6, 2013 14:02
Show Gist options
  • Save charlie/4722676 to your computer and use it in GitHub Desktop.
Save charlie/4722676 to your computer and use it in GitHub Desktop.
1.9.3p374 :001 > "\x90".force_encoding(Encoding::WINDOWS_1250).valid_encoding?
=> true
1.9.3p374 :002 > "\x90".force_encoding(Encoding::WINDOWS_1250).encode("UTF-8")
Encoding::UndefinedConversionError: "\x90" to UTF-8 in conversion from Windows-1250 to UTF-8
from (irb):2:in `encode'
from (irb):2
from /Users/charleshornberger/.rvm/rubies/ruby-1.9.3-p374/bin/irb:16:in `<main>'
@tenderlove
Copy link

You get a replacement character, but you can define the replacement character:

omg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment