handling unicode data

"Martin v. Löwis" martin at v.loewis.de
Wed Jul 5 14:54:11 EDT 2006


Filipe wrote:
> They do, in fact, output different values. The value outputed by
> pyscripter was "135" (x87) while the value outputed in the command line
> was "216" (xd8). I can't understand why though, because the script
> being run is precisely the same on both environments.

That's indeed surprising, and doesn't really increase trust into
pymssql.

If we look at the values of

>     print ord(row[1][4])
(where row is the actual data read from the database)

we get

> The values outputed were, in pyscripter:
> 135

Here, 135==0x87 really is LATIN SMALL LETTER C WITH CEDILLA in
code page 850.

> and in the command line
> 216

216==0xd8 is not LATIN SMALL LETTER C WITH CEDILLA in any
encode I know, so it appears that this value is bogus.
One would have to ask the authors of pymssql, or Microsoft,
why that happens; alternatively, you have to run pymssql
in a debugger to find out yourself.

Regards,
Martin



More information about the Python-list mailing list