converting u'11\xa022' to '11\xa022'

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Feb 21 01:37:58 EST 2007


En Wed, 21 Feb 2007 00:31:32 -0300, alf <ask at me.xs4all.nl> escribió:

> one more question, once a unicode object is created e.g.
>
> u=unicode('hello', 'iso-8859-1')
>
> is there any way to find:
> 	1-original encoding of u

No.
It's like, if you have variable "a" with value 10, you can't know if it  
came from:
a = 10
a = 0x0A
a = 012
or even a = len(sys.version_info)<<1, or whatever

> 	2-list of supported encodings?
I don't know how to query the list, except by reading the documentation  
for the codecs module.

-- 
Gabriel Genellina




More information about the Python-list mailing list