当前位置:网站首页>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)
边栏推荐
- 云呐|固定资产管理系统主要操作流程有哪些
- [Luogu cf487e] tours (square tree) (tree chain dissection) (line segment tree)
- Determinant learning notes (I)
- 妙才周刊 - 8
- Yunna | what are the main operating processes of the fixed assets management system
- [binary search tree] add, delete, modify and query function code implementation
- What is a humble but profitable sideline?
- 激光slam学习记录
- China Jinmao online electronic signature, accelerating the digitization of real estate business
- Mysql - CRUD
猜你喜欢
Initialiser votre vecteur & initialisateur avec une liste Introduction à la Liste
单商户V4.4,初心未变,实力依旧!
[noi simulation] Anaid's tree (Mobius inversion, exponential generating function, Ehrlich sieve, virtual tree)
多普勒效應(多普勒頻移)
Tips for using pads router
Learn PWN from CTF wiki - ret2libc1
There is no network after configuring the agent by capturing packets with Fiddler mobile phones
云呐|固定资产管理系统功能包括哪些?
[designmode] Decorator Pattern
wx. Getlocation (object object) application method, latest version
随机推荐
硬件及接口学习总结
云呐|公司固定资产管理系统有哪些?
QT -- thread
教你在HbuilderX上使用模拟器运行uni-app,良心教学!!!
PV static creation and dynamic creation
Problem solving win10 quickly open ipynb file
Hudi of data Lake (2): Hudi compilation
[online chat] the original wechat applet can also reply to Facebook homepage messages!
什么叫做信息安全?包含哪些内容?与网络安全有什么区别?
FFT 学习笔记(自认为详细)
Permission problem: source bash_ profile permission denied
CloudCompare&PCL 点云随机添加噪声
What is a humble but profitable sideline?
跟着CTF-wiki学pwn——ret2libc1
C file and folder operation
数据库遇到的问题
How much do you know about the bank deposit business that software test engineers must know?
第16章 OAuth2AuthorizationRequestRedirectWebFilter源码解析
7.5模拟赛总结
关于slmgr命令的那些事