Last active
November 20, 2018 21:42
-
-
Save teknofire/4dfac249b9e979af7aac6988a3178d9a to your computer and use it in GitHub Desktop.
This file contains 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
a = "\x91" # Windows-1252 hex code for curly quote | |
puts a | |
puts a.valid_encoding? | |
puts a.force_encoding('Windows-1252') | |
puts a.force_encoding('Windows-1252').encode('UTF-8') |
This file contains 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):034:0> a = "\x91" # Windows-1252 hex code for curly quote | |
=> "\x91" | |
irb(main):035:0> puts a | |
� | |
=> nil | |
irb(main):036:0> puts a.valid_encoding? | |
false | |
=> nil | |
irb(main):037:0> puts a.force_encoding('Windows-1252') | |
� | |
=> nil | |
irb(main):038:0> puts a.force_encoding('Windows-1252').encode('UTF-8') | |
‘ | |
=> nil | |
irb(main):039:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment