当前位置:网站首页>qt中toLocal8Bit和toUtf8()有什么区别
qt中toLocal8Bit和toUtf8()有什么区别
2022-06-30 19:05:00 【hebao0】
将QString 字符串写入文件时,通常会借用QByteArray作为中间变量,有两种方法。
QString::toUtf8是输出UTF-8编码的字符集
QString::toLatin1是相当与ASCii码不包含中文的遇到中文默认转换为ascii码0x3f也就是字符’?‘
QString::Local8bit是本地操作系统设置的字符集编码,一般为GB2312.
查看本地操作系统设置的字符集编码,启动cmd ,输入chcp,
活动代码页为936,意思是"中国-简体中文(GB2312)"
QFile file("out.txt");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
return;
QString msg = "哈哈";
QByteArray byte= msg.toLocal8Bit();
file.write(byte);
file.close();
ANSI码(American National Standards Institute),在中国,这里理解成GB2312即可
边栏推荐
- Unity technical manual - preliminary performance optimization
- MySQL数据库查询优化
- 微信小程序快速入门 --项目介绍
- 虚拟主机什么时候适合更换成云主机?
- Cartoon | has Oracle been abandoned by the new era?
- Advanced skills of testers: a guide to the application of unit test reports
- dataloader 源码_DataLoader
- Code shoe set - mt3435 · assignment - bipartite graph problem - Graphic explanation
- 【NLP】【TextCNN】 文本分类
- 为什么越来越多的人选择云渲染?
猜你喜欢
VR全景添加对比功能,让差异化效果展示更直观!
6-1漏洞利用-FTP漏洞利用
【已解决】抖音如何取消关注已注销的账户
Code shoe set - mt3435 · assignment - bipartite graph problem - Graphic explanation
Final chapter of binary tree
VoIP Push 在海外音视频业务中的应用
Small notes - integer improvement (C language)
ArcGIS no plug-in load (no offset) day map
将 EMQX Cloud 数据通过公网桥接到 AWS IoT
Growth summer challenge is coming, exclusive community welfare is coming ~ get CSDN customized T-shirt for free
随机推荐
PS2手柄-1「建议收藏」
JVM常见问题
4.3寸触控屏12路控制端口可编程网络中控支持5台中控主机相互备份
企业中通过组策略管理Edge浏览器设置(IE模式、主页绑定等)
Safe holidays without holidays, VR traffic makes children travel safely | Guangzhou Sinovel viewpoint
Temperature measuring instrument based on STM32 single chip microcomputer
pycharm从安装到全副武装,学起来才嗖嗖的快,图片超多,因为过度详细!
A detailed explanation of the implementation principle of go Distributed Link Tracking
How does an in memory database take advantage of memory?
Await and async
Why do more and more people choose cloud rendering?
超视频时代的音视频架构建设|Science和英特尔联袂推出“架构师成长计划”第二季
假期安全不放假,VR交通让孩子安全出行|广州华锐视点
MQ的选择(2022.5.9-5.15)
History, selection strategy and in-depth evaluation of note taking software
实现各种效果和功能的按钮,读这篇文章就够了
连接实验室服务器
Advanced skills of testers: a guide to the application of unit test reports
Connect to lab server
美国服务器租用和托管服务哪个好?