Created
October 26, 2012 16:36
-
-
Save brixen/3959786 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sasha:rubinius brian$ irb | |
| 1.9.3p286 :001 > "abc".force_encoding('ascii-8bit') + "\xff".force_encoding('us-ascii') | |
| => "abc\xFF" | |
| 1.9.3p286 :002 > a = "\x12:\xFF\xB6\xB3\x8D\xB8\x03".force_encoding('ascii-8bit') | |
| => "\x12:\xFF\xB6\xB3\x8D\xB8\x03" | |
| 1.9.3p286 :003 > b = "\x98~<\x84\xC3F|X".force_encoding 'us-ascii' | |
| => "\x98~<\x84\xC3F|X" | |
| 1.9.3p286 :004 > a + b | |
| Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and US-ASCII | |
| from (irb):4 | |
| from /Users/brian/.rvm/rubies/ruby-1.9.3-p286/bin/irb:16:in `<main>' | |
| 1.9.3p286 :005 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment