Created
April 12, 2009 10:53
-
-
Save bastien/93955 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
# Extracts the hexadecimal code from a string and converts it into the corresponding unicode character | |
# | |
# code found there -> http://www.nabble.com/Euro-currency-symbol-td22795833.html ( by David Wright ) | |
def convert(code) | |
return [code.gsub("U+", "").hex].pack("U") | |
end | |
puts convert("U+634F") # -> 捏 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment