I'm having issues sending unicode to SQL Server via pymssql:
In [1]: import pymssql
conn = pymssql.connect(host='hostname', user='me', password='password', database='db')
cursor = conn.cursor()
In [2]: s = u'Monsieur le Curé of the «Notre-Dame-de-Grâce» neighborhood'
In [3]: s
Out [3]: u'Monsieur le Cur\xe9 of the \xabNotre-Dame-de-Gr\xe2ce\xbb neighborhood'
In [4]: cursor.execute("INSERT INTO MyTable VALUES(%s)", s.encode('utf-8'))
cursor.execute("INSERT INTO MyTable VALUES(" + s.encode('utf-8') + "')")
conn.commit()
Both execute statements yield the same garbled text on the SQL Server side:
'Monsieur le Curé of the «Notre-Dame-de-Grâce» neighborhood'
Maybe something is wrong with the way I'm encoding, or with my syntax. Someone suggested a stored procedure, but I'm hoping not to have to go that route.
This seems to be a very similar problem, with no real response.