Python 2.6.4 (Win32): Anyone have any explanation for the
following

encodings.idna.ToASCII( unicodeStr ) != unicodeStr.encode( 'idna'
)

Given that other processes may have to use the output of these
methods, what is the recommended technique?

Demonstration:

>>> import encodings.idna
>>> name = u'junk\xfc\xfd.txt'
>>> name
u'junk\xfc\xfd.txt'
>>> encodings.idna.ToASCII( name )
'xn--junk.txt-95ak'
>>> name.encode( 'idna' )
'xn--junk-3rag.txt'
>>> encodings.idna.ToUnicode( encodings.idna.ToASCII( name ) )
u'junk\xfc\xfd.txt'
>>> name.encode( 'idna' ).decode( 'idna' )
u'junk\xfc\xfd.txt'

The good news is that the encodings.idna and string idna
transformations appear to properly mirror when used with their
matching transformation.

The bad news is that encodings.idna and the equivalent str
transformations can't be intermixed.

Malcolm
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to