Created
December 18, 2008 12:06
-
-
Save dmilith/37471 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
| irb(main):003:0> z = "żxczółą".force_encoding "UTF-8" | |
| => "\305\274xcz\303\263\305\202\304\205" | |
| irb(main):004:0> z.tr "ż", "Ż" | |
| ArgumentError: incompatible character encodings: UTF-8 and ASCII-8BIT | |
| from (irb):5 | |
| irb(main):012:0> z.tr "ż".force_encoding("UTF-8"), "Ż".force_encoding("UTF-8") | |
| => "\305\273xcz\303\263\305\202\304\205" | |
| irb(main):013:0> z | |
| => "\305\274xcz\303\263\305\202\304\205" | |
| irb(main):014:0> puts z | |
| żxczółą | |
| => nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment