﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-keejun</title><link>http://www.cppblog.com/keejun/</link><description>shot to go</description><language>zh-cn</language><lastBuildDate>Tue, 09 Jun 2026 17:40:06 GMT</lastBuildDate><pubDate>Tue, 09 Jun 2026 17:40:06 GMT</pubDate><ttl>60</ttl><item><title>qt  c++解决中文乱码</title><link>http://www.cppblog.com/keejun/archive/2012/10/08/193029.html</link><dc:creator>keejunl</dc:creator><author>keejunl</author><pubDate>Mon, 08 Oct 2012 14:49:00 GMT</pubDate><guid>http://www.cppblog.com/keejun/archive/2012/10/08/193029.html</guid><wfw:comment>http://www.cppblog.com/keejun/comments/193029.html</wfw:comment><comments>http://www.cppblog.com/keejun/archive/2012/10/08/193029.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/keejun/comments/commentRss/193029.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/keejun/services/trackbacks/193029.html</trackback:ping><description><![CDATA[<div><div style="font-size: medium;"><strong><span style="font-family: 华文楷体;">&nbsp;先在主源文件的头文件上添加 ：</span></strong></div><div style="font-size: medium;"><span style="font-family: 华文楷体;"><strong>＃include＜qtextcodec＞</strong></span></div><div style="font-size: medium;"><span style="font-family: 华文楷体;"><strong>然后在ｍａｉｎ中添加：</strong></span></div><div style="font-size: medium;"><pre style="margin-top: 0px; margin-bottom: 0px;" xml:space="preserve"><span style="color: #800080;">QTextCodec</span>::setCodecForTr(<span style="color: #800080;">QTextCodec</span>::codecForName(<span style="color: #008000;">"gb2312"</span>)); </pre><pre style="margin-top: 0px; margin-bottom: 0px;" xml:space="preserve"><span style="color: #800080;">QTextCodec</span>::setCodecForLocale(<span style="color: #800080;">QTextCodec</span>::codecForName(<span style="color: #008000;">"gb2312"</span>)); </pre><pre style="margin-top: 0px; margin-bottom: 0px;" xml:space="preserve"><span style="color: #800080;">QTextCodec</span>::setCodecForCStrings(<span style="color: #800080;">QTextCodec</span>::codecForName(<span style="color: #008000;">"gb2312"</span>)); </pre><span style="font-family: 华文新魏;">即可将文件实现的程序变成中文不乱码。</span></div></div><img src ="http://www.cppblog.com/keejun/aggbug/193029.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/keejun/" target="_blank">keejunl</a> 2012-10-08 22:49 <a href="http://www.cppblog.com/keejun/archive/2012/10/08/193029.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>