Re: How to decode a string

2006-08-22 Thread Lad
Fredrik Lundh wrote: > "Lad" wrote: > > > The result of print "*", repr(RealName), type(RealName), "*" is > > > > * 'Fritschov\xe1 Laura' * > > looks like the MySQL interface is returning 8-bit strings using ISO-8859-1 > encoding (or some variation of that; \xE1 is "LATIN SMALL LETTER A > WITH AC

Re: How to decode a string

2006-08-22 Thread Fredrik Lundh
"Lad" wrote: > The result of print "*", repr(RealName), type(RealName), "*" is > > * 'Fritschov\xe1 Laura' * looks like the MySQL interface is returning 8-bit strings using ISO-8859-1 encoding (or some variation of that; \xE1 is "LATIN SMALL LETTER A WITH ACUTE" in 8859-1). have you tried passi

Re: How to decode a string

2006-08-22 Thread Lad
Fredrik Lundh wrote: > Lad wrote: > > > for > > print repr(RealName) command > > I will get > > > > P?ibylov\xe1 Ludmila > > where instead of ? should be also a character > > that's not very likely; repr() always includes quotes, always escapes > non-ASCII characters, and optionally includes a Un

Re: How to decode a string

2006-08-22 Thread Fredrik Lundh
Lad wrote: > for > print repr(RealName) command > I will get > > P?ibylov\xe1 Ludmila > where instead of ? should be also a character that's not very likely; repr() always includes quotes, always escapes non-ASCII characters, and optionally includes a Unicode prefix. please try this prin

Re: How to decode a string

2006-08-21 Thread Lad
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Lad wrote: > > > The text is from Mysql table field that uses utf8_czech_ci collation, > > but when I try > > `RealName`.decode('utf8'),where RealName is that field of MySQL > > > > I will get: > > UnicodeDecodeError: 'ascii' codec can't d

Re: How to decode a string

2006-08-21 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Lad wrote: > The text is from Mysql table field that uses utf8_czech_ci collation, > but when I try > `RealName`.decode('utf8'),where RealName is that field of MySQL > > I will get: > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: > ordinal > not

Re: How to decode a string

2006-08-21 Thread Lad
Fredrik Lundh wrote: > Lad wrote: > > > To be able to decode a string successfully, I need to know what coding > > it is in. > > ask whoever provided the string. > > > The string can be coded in utf8 or in windows-1250 or in another > > coding. Is there a method how to find out the string coding.

Re: How to decode a string

2006-08-21 Thread Fredrik Lundh
Lad wrote: > To be able to decode a string successfully, I need to know what coding > it is in. ask whoever provided the string. > The string can be coded in utf8 or in windows-1250 or in another > coding. Is there a method how to find out the string coding. in general, no. if you have enough

How to decode a string

2006-08-21 Thread Lad
To be able to decode a string successfully, I need to know what coding it is in. The string can be coded in utf8 or in windows-1250 or in another coding. Is there a method how to find out the string coding. Thank you for help L. -- http://mail.python.org/mailman/listinfo/python-list