This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[patch]konversation 无乱码补丁[同时显示 utf8/gb18030 编码]

Tags: None
(comma "," separated)
User avatar
nihui
Registered Member
Posts
26
Karma
0
OS
如题
当 utf8 不能解析时使用 gb18030。
基本上可以解决所有中文乱码,包括 windows 的 mirc 发的消息 8)
只适用于中文用户,所以无法直接在上游解决。

文件名 konversation-1.2.1-fallback_to_gb18030.patch
Code: Select all
diff -Nuarp konversation-1.2.1/src/irc/server.cpp konversation-1.2.1.fallback_to_gb18030/src/irc/server.cpp
--- konversation-1.2.1/src/irc/server.cpp   2009-11-12 13:24:48.000000000 +0800
+++ konversation-1.2.1.fallback_to_gb18030/src/irc/server.cpp   2009-12-29 20:06:13.000000000 +0800
@@ -1066,9 +1066,9 @@ void Server::incoming()
                 codec = Konversation::IRCCharsets::self()->codecForName(channelEncoding);
 
             // if channel encoding is utf-8 and the string is definitely not utf-8
-            // then try latin-1
+            // then try GB18030
             if ( !isUtf8 && codec->mibEnum() == 106 )
-                codec = QTextCodec::codecForMib( 4 /* iso-8859-1 */ );
+                codec = QTextCodec::codecForMib( 114 /* GB18030 */ );
 
             m_inputBuffer << codec->toUnicode(first);
         }


Akonadi · aRts · D-Bus · Decibel · Flake · KJS · KDOM · KHTML · KIO · Kiosk · KIPI · KParts · Kross · KSVG · KWin · NEPOMUK · Oxygen · Phonon · Plasma · Qt · Solid · Sonnet · Soprano · Strigi · ThreadWeaver · WebKit · XMLGUI
User avatar
dbhrscom
Registered Member
Posts
11
Karma
0
OS
支持!:|


dbhrscom, proud to be a member of KDE forums since 2008-Oct.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kesang, Sogou [Bot], Yahoo [Bot]