unicode study with unicodedata module
Xah Lee
xah at xahlee.org
Wed Mar 16 05:02:35 EST 2005
here's a snippet of code that prints a range of unicode chars, along
with their ordinal in hex, and name.
chars without a name are skipped. (some of such are undefined code
points.)
On Microsoft Windows the encoding might need to be changed to utf-16.
Change the range to see different unicode chars.
# -*- coding: utf-8 -*-
from unicodedata import *
l=[]
for i in range(0x0000, 0x0fff):
l.append(eval('u"\\u%04x"' % i))
for x in l:
if name(x,'-')!='-':
print x.encode('utf-8'),'|', "%04x"%(ord(x)), '|', name(x,'-')
--
http://xahlee.org/perl-python/unicodedata_module.html
anyone wants to supply a Perl version?
Xah
xah at xahlee.org
http://xahlee.org/PageTwo_dir/more.html
Brian McCauley wrote:
> Xah Lee wrote:
>
> > i don't know what's the state of Perl's unicode.
>
> perldoc perlunicode
More information about the Python-list
mailing list