[Tutor] pymssql and encoding
evert.rol at gmail.com
Wed Oct 6 22:38:18 CEST 2010
> >>> print customerName
> ImmobiliŠre (whatever)
> >>> customerName
> 'Immobili\x8are (whatever)'
> There should be a small E with a grave accent (è) instead of the capital S with a caron (Š) I'm getting.
> I've tried applying various encodings, but to no avail:
> When executed from MS SQL Server's Management Studio, the same query returns "Immobilière (whatever)", with an 'è', as it should.
> The field in question is of type nvarchar, with collation SQL_Latin1_General_CP850_CI_AS.
Well, you're SQL server seems to use CP850, which is (almost) the first encoding I tried:
>>> name= 'Immobili\x8are'
>>> print name.decode('cp850')
Seems to work for me.
More information about the Tutor