Skip to content

Instantly share code, notes, and snippets.

@valueof
Created June 10, 2010 16:59
Show Gist options
  • Save valueof/433294 to your computer and use it in GitHub Desktop.
Save valueof/433294 to your computer and use it in GitHub Desktop.
def to_unicode(f):
if isinstance(f, dict):
for k, v in f.iteritems():
f[str(k)] = to_unicode(v)
elif isinstance(f, (list, tuple)):
f = [to_unicode(f) for f in f]
elif isinstance(f, str):
f = f.decode('utf-8')
else:
f = unicode(f)
return f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment