Created
October 28, 2012 16:25
-
-
Save kamarcum/3969065 to your computer and use it in GitHub Desktop.
Generating non-UTF-8 strings in ruby for testing
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
# It's sort of difficult to make a non-UTF-8 string in | |
# ruby that contains characters that aren't in UTF-8. | |
# Here's how I did it. | |
# 0x89 isn't allowed in UTF-8 | |
bad_chars = [0x89].pack("c*").force_encoding("ISO-8859-1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment