[Python-talk] unicode handling in older Python versions

Lloyd Kvam python at venix.com
Sat Oct 3 10:46:45 EDT 2009


On Sat, 2009-10-03 at 10:10 -0400, Arc Riley wrote:
> # -*- coding: utf-8 -*-
> print(ascii('𐑑'))
> print(ascii('\U00010451'))
> 
That code is problematic for old Pythons.

Is this useful???  I guess I still do not understand how to demonstrate
the bug.

[~]|9> import sys
[~]|10> print sys.maxunicode
1114111
[~]|11> first = u'\U00010451'
[~]|12> first == first.encode('utf8').decode('utf8')
   <12> True
[~]|13> first == first.encode('utf16').decode('utf16')
   <13> True
[~]|15> sys.version
   <15> '2.5.2 (r252:60911, Sep 30 2008, 15:41:38) \n[GCC 4.3.2 20080917
(Red Hat 4.3.2-4)]'

-- 
Lloyd Kvam
Venix Corp
DLSLUG/GNHLUG library
http://dlslug.org/library.html
http://www.librarything.com/catalog/dlslug
http://www.librarything.com/rsshtml/recent/dlslug
http://www.librarything.com/rss/recent/dlslug



More information about the Python-talk mailing list