Skip to content

Instantly share code, notes, and snippets.

@nhanb
Created May 2, 2014 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhanb/a6457ba747d516232776 to your computer and use it in GitHub Desktop.
Save nhanb/a6457ba747d516232776 to your computer and use it in GitHub Desktop.
def toFullwidth(halfwidth):
# Only convert these characters
en_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~'
def shift(char):
return unichr(0XFEE0 + ord(c)) if char in en_chars else char
return u''.join([shift(c) for c in halfwidth])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment