当前位置:网站首页>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)边栏推荐
- Hudi of data Lake (1): introduction to Hudi
- The global and Chinese markets of dial indicator calipers 2022-2028: Research Report on technology, participants, trends, market size and share
- [binary search tree] add, delete, modify and query function code implementation
- Global and Chinese market of water heater expansion tank 2022-2028: Research Report on technology, participants, trends, market size and share
- 【DesignMode】装饰者模式(Decorator pattern)
- 7.5 simulation summary
- After summarizing more than 800 kubectl aliases, I'm no longer afraid that I can't remember commands!
- Make a short video clip number of we media film and television. Where can I download the material?
- Zhuan: in the future, such an organization can withstand the risks
- [noi simulation] Anaid's tree (Mobius inversion, exponential generating function, Ehrlich sieve, virtual tree)
猜你喜欢
随机推荐
【luogu CF487E】Tourists(圆方树)(树链剖分)(线段树)
CloudCompare&PCL 点云随机添加噪声
NSSA area where OSPF is configured for Huawei equipment
剖面测量之提取剖面数据
What are the functions of Yunna fixed assets management system?
Tips for using pads router
Key structure of ffmpeg - avformatcontext
2022.7.5-----leetcode.729
Global and Chinese market of digital serial inverter 2022-2028: Research Report on technology, participants, trends, market size and share
【GYM 102832H】【模板】Combination Lock(二分图博弈)
Start from the bottom structure and learn the introduction of fpga---fifo IP core and its key parameters
MySQL global lock and table lock
Global and Chinese markets for pressure and temperature sensors 2022-2028: Research Report on technology, participants, trends, market size and share
7.5模拟赛总结
Problems encountered in the database
How to rotate the synchronized / refreshed icon (EL icon refresh)
[day39 literature extensive reading] a Bayesian perspective on magnetic estimation
Detailed explanation of APP functions of door-to-door appointment service
MySql——CRUD
传输层协议------UDP协议








