view bin/toutf8 @ 3900:b1b0dcb5ad5e

<fizzie> printf \'%s\\n\' \'#!/usr/bin/env python\' \'import sys\' \'import unicodedata\' \'print u" ".join("[U+{0:04x} {1}]".format(ord(c), unicodedata.name(c, "DUNNO")) for c in " ".join(sys.argv[1:]).decode("utf-8")).encode("utf-8")\' > bin/unidecode
author HackBot
date Fri, 11 Oct 2013 13:57:18 +0000
parents e037173e0012
children
line wrap: on
line source

#!/usr/bin/python
import sys
import chardet
x = sys.stdin.read()
enc = chardet.detect(x)['encoding']
sys.stdout.write(x.decode(enc).encode('UTF-8'))