开发者

FREETDS and UNIXODBC character converting

iv开发者_C百科e got an error to fix. its:

[FreeTDS][SQL Server]Error converting characters into server's character set. Some character(s) could not be converted

when i use turkish characters to insert i get this error. my question is how can i disable that converting thing? im connecting to sql server via freetds and unixodbc.

thanks..


You need to set

clientcharset = UTF-8

in your freetds.conf file and read it from odbc.ini by setting the Servername option to the connection definition in freetds.com. See this explanation and my blog post.


in python3, you need to add two lines after your conn

import pyodbc as db # forgot the imports
conn = pyodbc.connect(driver=driver, server=serv, database=db,port = prt,
                  uid=usr, pwd=passwd)
conn.setdecoding(db.SQL_CHAR, encoding='latin1')
conn.setencoding('latin1')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜