Successful resolution: Insert connecting sql server database content is garbled, and the output is garbled

Successful resolution: Insert connecting sql server database content is garbled, and the output is garbled

 

 

table of Contents

Solve the problem

Solution


 

 

Solve the problem

pymssql connected database, records inserted garbled, Python output is garbled

Connection statement

pymssql.connect = conn (Host = "192.168.86.1", the User = "SA", password = "SASA", Database = data_base, charset = "GBK")
charset types of options are GBK, utf8 and so on, how to choose is very important , which should be selected according to the field type your database connection table,
1, for example, when you field type is varchar (50), you will choose a manner GBK read and displayed, but if your environment python utf8 encoding format

Guess you like

Origin blog.csdn.net/qq_41185868/article/details/80959990