当前位置:网站首页>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)
边栏推荐
- Which side projects can be achieved? Is it difficult for we media to earn more than 10000 a month?
- [Luogu cf487e] tours (square tree) (tree chain dissection) (line segment tree)
- PV static creation and dynamic creation
- DEJA_ Vu3d - cesium feature set 055 - summary description of map service addresses of domestic and foreign manufacturers
- 行列式学习笔记(一)
- Yunna | what are the main operating processes of the fixed assets management system
- 第16章 OAuth2AuthorizationRequestRedirectWebFilter源码解析
- JS 这次真的可以禁止常量修改了!
- Determinant learning notes (I)
- China Jinmao online electronic signature, accelerating the digitization of real estate business
猜你喜欢
教你在HbuilderX上使用模拟器运行uni-app,良心教学!!!
Ffmpeg learning - core module
Huawei equipment configuration ospf-bgp linkage
传输层协议------UDP协议
[noi simulation] Anaid's tree (Mobius inversion, exponential generating function, Ehrlich sieve, virtual tree)
18. (ArcGIS API for JS) ArcGIS API for JS point collection (sketchviewmodel)
[day39 literature extensive reading] a Bayesian perspective on magnetic estimation
MySQL之函数
【DesignMode】装饰者模式(Decorator pattern)
FFT 学习笔记(自认为详细)
随机推荐
Learn PWN from CTF wiki - ret2libc1
Teach you to run uni app with simulator on hbuilderx, conscience teaching!!!
Zero rhino technology joined hands with the intelligence Club: the "causal faction" forum was successfully held, and the "causal revolution" brought the next generation of trusted AI
Global and Chinese market of water heater expansion tank 2022-2028: Research Report on technology, participants, trends, market size and share
[designmode] composite mode
Gd32f4xx UIP protocol stack migration record
Global and Chinese market of digital serial inverter 2022-2028: Research Report on technology, participants, trends, market size and share
提升工作效率工具:SQL批量生成工具思想
GD32F4xx uIP协议栈移植记录
Detailed explanation of APP functions of door-to-door appointment service
AtCoder Beginner Contest 254【VP记录】
CloudCompare&PCL 点云随机添加噪声
Zhuan: in the future, such an organization can withstand the risks
What are Yunna's fixed asset management systems?
第16章 OAuth2AuthorizationRequestRedirectWebFilter源码解析
XML configuration file (DTD detailed explanation)
Mathematical model Lotka Volterra
JS 这次真的可以禁止常量修改了!
激光slam学习记录
MySQL之函数