当前位置:网站首页>Solve the problem of reading Chinese garbled code in sqlserver connection database
Solve the problem of reading Chinese garbled code in sqlserver connection database
2022-07-06 00:12:00 【Addiction ۣۖ ิ ۣۖ ิ ۣۖ ิꦿ】
In a sophomore's database class , On a dark and windy night , I suddenly realized that , stay pycharm Characters that I have never seen appear on the terminal , It turned out that the Chinese display read was garbled , And then the operation is as fierce as a tiger , Start crazy Baidu , In two hours , I got the reason for the problem .
because SQLServer I won't support it UTF-8, When using varchar When saving Chinese characters , There will be garbled code , Need to transform .
cast function
We will need to select the columns to display , utilize cast function , use nvarchar Save Chinese characters , It can solve the problem of Chinese garbled code
select cast(xx as nvarchar(20)) xxxx …
def showall(self):
self.model.removeRows(0, self.model.rowCount())
sql = "SELECT OwnerId,cast(OwnerName as nvarchar(20)),cast(OwnerSex as nvarchar(20)),OwnerBir,OwnerPhone,OwnerIdent,BuildId,RoomId FROM Owner"
self.cur.execute(sql)
rows = self.cur.fetchall()
print(rows)
self.addItem(rows)
边栏推荐
猜你喜欢
【DesignMode】组合模式(composite mode)
How much do you know about the bank deposit business that software test engineers must know?
What are Yunna's fixed asset management systems?
Single merchant v4.4 has the same original intention and strength!
[online chat] the original wechat applet can also reply to Facebook homepage messages!
Initialize your vector & initializer with a list_ List introduction
认识提取与显示梅尔谱图的小实验(观察不同y_axis和x_axis的区别)
Laser slam learning record
OS i/o devices and device controllers
Initialiser votre vecteur & initialisateur avec une liste Introduction à la Liste
随机推荐
Priority queue (heap)
认识提取与显示梅尔谱图的小实验(观察不同y_axis和x_axis的区别)
Permission problem: source bash_ profile permission denied
剖面测量之提取剖面数据
Chapter 16 oauth2authorizationrequestredirectwebfilter source code analysis
QT QPushButton details
[designmode] Decorator Pattern
什么叫做信息安全?包含哪些内容?与网络安全有什么区别?
DEJA_ Vu3d - cesium feature set 055 - summary description of map service addresses of domestic and foreign manufacturers
选择致敬持续奋斗背后的精神——对话威尔价值观【第四期】
What if the C disk is not enough? Let's see how I can clean up 25g of temp disk space after I haven't redone the system for 4 years?
USB Interface USB protocol
用列表初始化你的vector&&initializer_list简介
Detailed explanation of APP functions of door-to-door appointment service
MySql——CRUD
行列式学习笔记(一)
从底层结构开始学习FPGA----FIFO IP核及其关键参数介绍
Determinant learning notes (I)
MySQL之函数
18. (ArcGIS API for JS) ArcGIS API for JS point collection (sketchviewmodel)