Created
May 3, 2013 09:03
-
-
Save 10io/5508094 to your computer and use it in GitHub Desktop.
Convert any non ASCII char to their Unicode code point:
Héllo -> H\u00e9ello
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
| string.gsub(/[^\x00-\x7F]/) { |non_ascii| "\\u#{"%4.4x" % non_ascii.ord}" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment