[Tutor] pymssql and encoding
emmanuel.ruellan at laposte.net
Thu Oct 7 00:14:15 CEST 2010
Perfect! Thanks Evert.
I realise now that I don't fully grasp the concepts of encoding and
collation and their relationship.
On Wed, Oct 6, 2010 at 10:38 PM, Evert Rol <evert.rol at gmail.com> wrote:
> > >>> 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:
> <snip />
> > 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
> Well, you're SQL server seems to use CP850, which is (almost) the first
> encoding I tried:
> >>> name= 'Immobili\x8are'
> >>> name
> >>> print name.decode('cp850')
> Seems to work for me.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor