I like Unicode more than I used to...

Steven Taschuk staschuk at telusplanet.net
Sat Feb 15 10:40:44 EST 2003


Quoth Skip Montanaro:
> Now that I have a terminal application which can display utf-8 encoded data,
> I'm beginning to form a better opinion of Unicode.  I can do something like:
> 
>     >>> import codecs
>     >>> f = codecs.open("foo.test", "wb", "utf-8")
>     >>> f.write("abc\r\n")
>     >>> f.write(u"\N{TRADE MARK SIGN}\r\n")
>     >>> f.write(u"\u8482\r\n")
>     >>> f.close()

Incidentally, the trade mark sign was referred to as character
8482 in that other thread because that's its decimal value:
	>>> u'\N{TRADE MARK SIGN}'
	u'\u2122'
	>>> 0x2122
	8482

-- 
Steven Taschuk           | import bisect, sys
staschuk at telusplanet.net | for line in sys.stdin: print ''.join([chr(ord(c)-13
                         | +bisect.bisect('\0AN[an{',c)%3*13) for c in line]),





More information about the Python-list mailing list