Asterix wrote:
> how could I test that those 2 strings are the same:
>
> 'séd' (repr is 's\\xc3\\xa9d')
>
> u'séd' (repr is u's\\xe9d')
You may also want to look at unicodedata.normalize(). For example, é can
be represented multiple ways:
>>> import unicodedata
>>> unicodedata.normalize('NFC',
Par Toutatis !
Si tu avais posé la question à Ordralphabétix, ou sur un des ng français
consacrés à Python, au lieu de refaire "La grande Traversée", la réponse
aurait peut-être été plus rapide.
@-salutations
--
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Asterix wrote:
how could I test that those 2 strings are the same:
'séd' (repr is 's\\xc3\\xa9d')
u'séd' (repr is u's\\xe9d')
determine what encoding the former string is using (looks like UTF-8),
and convert it to Unicode before doing the comparision.
>>> b = 's\xc3\xa9d'
>>> u = u's\xe9
On Aug 31, 11:04 pm, Asterix <[EMAIL PROTECTED]> wrote:
> how could I test that those 2 strings are the same:
>
> 'séd' (repr is 's\\xc3\\xa9d')
>
> u'séd' (repr is u's\\xe9d')
[note: your reprs are wrong; change the \\ to \]
You need to decode the non-unicode string and compare the result with
t
On Aug 31, 11:04 pm, Asterix <[EMAIL PROTECTED]> wrote:
> how could I test that those 2 strings are the same:
>
> 'séd' (repr is 's\\xc3\\xa9d')
No, the repr is 's\xc3\xa9d'.
>
> u'séd' (repr is u's\\xe9d')
No, the repr is u's\xe9d'.
To answer your question:
--
http://mail.python.org/mailman
how could I test that those 2 strings are the same:
'séd' (repr is 's\\xc3\\xa9d')
u'séd' (repr is u's\\xe9d')
--
http://mail.python.org/mailman/listinfo/python-list