Problems Writing £ (pound sterling) To MS SQL Server using pymssql

Darren Mansell darren.mansell at opengi.co.uk
Mon Nov 17 10:55:42 EST 2008


On Mon, 2008-11-17 at 15:24 +0000, Tim Golden wrote:
> Darren Mansell wrote:
> > Hi. 
> > 
> > I'm relatively new to python so please be gentle :)
> > 
> > I'm trying to write a £ symbol to an MS SQL server using pymsssql . This
> > works but when selecting the data back (e.g. using SQL management
> > studio) the £ symbol is replaced with £ (latin capital letter A with
> > circumflex).
> 
> 
> This is a bit of a non-answer but... use pyodbc[*],
> use NVARCHAR cols, and use unicode values on insert:
> 

Thanks for the help. Unfortunately pyodbc seems to only work on Windows.
I need to connect to the SQL server from a Linux box.

The db schema is very set in stone, I can't do anything with it. I'm
currently opening autogenerated SQL scripts, decoding them from utf-16
and then back into utf-8 for pymssql to run them.

It's been working great for ages until someone noticed the £ symbols had
this extra character in there..

-- 
Darren Mansell <darren.mansell at opengi.co.uk>




More information about the Python-list mailing list