Unable to send Unicode to SQL Server using pymssql

后端 未结 4 654
予麋鹿
予麋鹿 2021-01-14 04:46

I\'m having issues sending unicode to SQL Server via pymssql:

In [1]:     import pymssql
            conn = pymssql.connect(host=\'hostname\', user=\'me\', p         


        
4条回答
  •  轮回少年
    2021-01-14 05:39

    Ran into the same issue with pymssql and did not want to switch to pypyodbc

    For me, there was no issue in removing any accents seeing that I only needed first names as a reference. So this solution may not be for everyone.

    import unicodedate
    firstName = u'René'
    firstName = unicodedata.normalize('NFKD', firstName).encode('ascii', 'ignore')
    print firstName 
    

提交回复
热议问题