查看完整版本: [-- 读取xml文件的中文 QString 转std::string乱码 --]

QTCN开发网 -> Qt中文处理 -> 读取xml文件的中文 QString 转std::string乱码 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

ldxcomeon 2017-09-05 09:34

读取xml文件的中文 QString 转std::string乱码

使用版本Qt 5.5.1
文件编码为utf-8

在对xml进行读取中 有的xml标记为中文  想将xml的值转换为std::string 进行存储 结果发现乱码

toLatin1,toutf8 ,toLocal8bit都试了 还是乱码  请问这个该怎么解决

ldxcomeon 2017-09-05 09:36
编译器是vs2013

ldxcomeon 2017-09-05 09:40
xml文件是utf-8编码
<?xml version="1.0" encoding="UTF-8"?>

九重水 2017-09-05 10:28
标准库的string就是char的,楼主用过wstring吗?这个是16位的


查看完整版本: [-- 读取xml文件的中文 QString 转std::string乱码 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled