当前位置:网站首页>QT transfers the received JSON data (including Chinese) Unicode to utf8
QT transfers the received JSON data (including Chinese) Unicode to utf8
2022-06-10 14:07:00 【There is heavy snow in the South】
Recently in use qt adopt json Data format transfer data , Receive from device to qt Interface data display , There's a problem , The specific reasons for this are still in place .cpu adopt json Transfer data information to qt End , Because the data information contains Chinese , Chinese characters will be converted by default unicode Format transfer , In this way qt End receiving and parsing json Data time , If the amount of data is too large , Will cause parsing json The data of failure , Cannot find corresponding string ( The exact reason is unknown , The judgment should be caused by this reason ), The amount of data is relatively small, and this problem does not occur for the time being .
The method to avoid this problem can transcode the received data , To utf8:
LocalSocket::instance()->recvMsg(msg);// Received data
QTextCoder *code = QTextCodec::codevcForName("utf-8");
QByteArray msgUtf8 = code->fornUnicode(msg);// Transcoded data msgUtf8
边栏推荐
- 焱融看|混合云环境下,如何实现数据湖最优存储解决方案
- [cloud computing] what is the relationship between a multi cloud management platform and a public cloud?
- 2022山东省安全员C证复训题库及在线模拟考试
- Recyclerview multi layout writing method, "my" and "personal center" page classic writing method demonstration
- [special introduction] round table forum -- the integration of AI and audio and video technology
- net core天马行空系列-可用于依赖注入的,数据库表和c#实体类互相转换的接口实现
- Win10 virtual machine download and installation process
- Docker部署一个Redis集群
- 单例模式和特殊类设计
- Allan variance and random error identification
猜你喜欢

5.8G微波雷达模块使用,5.8G微波雷达模块工作原理和介绍
![[discrete mathematics review series] IV. figure](/img/70/5b2f783265e7e5f6485b49088400da.png)
[discrete mathematics review series] IV. figure

组装芯片难保竞争优势,痛定思痛的高通终于开始自研核心架构

大厂必备的40个方法论

解决安装gerapy的时候报错:ERROR: Cannot uninstall ‘certifi‘. It is a distutils installed project...
![[Chongqing University] information sharing of preliminary and second examinations (with postgraduate entrance examination group)](/img/1d/550a991385b842a21e2b301725407e.png)
[Chongqing University] information sharing of preliminary and second examinations (with postgraduate entrance examination group)

2022 high frequency software test interview questions of large factories (with answers)

2022 practice questions and online simulation test for the third batch of Guangdong Provincial Safety Officer a certificate (principal)

还在说大学排名是笑话?最新规定:世界top50大学可以直接落户上海!

大厂面试上午10:00面试,10:09就出来了 ,问的实在是太...
随机推荐
Redis基本使用1
The shortcomings of the "big model" and the strengths of the "knowledge map"
【解决】每次加载已经训练好的模型,生成的向量会有不同
什么是CAS 以及 CAS 中的 ABA 问题
解决跨海高并发崩溃难题?so easy
[Chongqing University] information sharing of preliminary and second examinations (with postgraduate entrance examination group)
Review summary of final examination of software architecture principles, methods and practices, Second Edition
2022广东省安全员A证第三批(主要负责人)考试练习题及在线模拟考试
【笔记】关于keil中的出现的编译映射内存不足的问题
1
CVPR 2022 | 基于序列对比学习的长视频逐帧动作表示
组装芯片难保竞争优势,痛定思痛的高通终于开始自研核心架构
Google Earth engine (GEE) - real time global 10 meter land use / land cover (LULC) data set based on S2 images
What happened when the legendary login prompt failed to connect to the server? How to solve it?
2022广东省安全员A证第三批(主要负责人)考试练习题及在线模拟考试
基于FPGA的VGA协议实现
Ue5 how to convert screen coordinates to world coordinates and World Directions
Primary master-slave table integration process development process
单例模式和特殊类设计
2022 practice questions and online simulation test for the third batch of Guangdong Provincial Safety Officer a certificate (principal)