Skip to content

Instantly share code, notes, and snippets.

@bastien
Created April 12, 2009 10:53
Show Gist options
  • Save bastien/93955 to your computer and use it in GitHub Desktop.
Save bastien/93955 to your computer and use it in GitHub Desktop.
# 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