Hi
Using the pymssql library, I want to write data to the MSSQL database, but I am facing encoding problems. Here is my sample code for writing to the database:
# -*- coding: utf-8 -*- import _mssql .... Connection info data here .... def mssql_connect(): return _mssql.connect(server=HOST, user=USERNAME, password=PASS, database=DB, charset="utf-8") con = mssql_connect() INSERT_EX_SQL = "INSERT INTO myDatabsae (Id, ProgramName, ProgramDetail) VALUES (1, 'Test Characters ÜŞiçÇÖö', 'löşüIIğĞü');" con.execute_non_query(INSERT_EX_SQL) con.close()
Unfortunately, the data recorded in the database is damaged:

The interaction of my mssql db: Turkish_CI_AS How can this be solved?
python sql-server character-encoding pymssql
Hellnar
source share