[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: A bug fix patch of RFC2047String (iso-2022-jp)
From: Toshitaka Fujioka <toshitaka () kde ! gr ! jp>
Date: 2001-02-21 19:17:45
[Download RAW message or body]
Hello,
I fixed a bug to occur with "decodeRFC2047String" and "encodeRFC2047String"
when I set iso-2022-jp in charset. (CVS of 16/02)
Before a patch application:
http://www.kde.gr.jp/~toshitaka/Kde/KMail/kmail_bug1.jpg
http://www.kde.gr.jp/~toshitaka/Kde/KMail/kmail_bug2.jpg
http://www.kde.gr.jp/~toshitaka/Kde/KMail/kmail_bug3.jpg
After a patch application:
http://www.kde.gr.jp/~toshitaka/Kde/KMail/kmail_bugfix1.jpg
http://www.kde.gr.jp/~toshitaka/Kde/KMail/kmail_bugfix2.jpg
http://www.kde.gr.jp/~toshitaka/Kde/KMail/kmail_bugfix3.jpg
I attached a patch. Please review. :-)
If my patch is wrong, please advise.
["kdenetwork-kmail-RFC2047String-fix-iso_2022_jp-20010222.diff" (text/x-c++)]
diff -ur kdenetwork.org/kmail/kmmsgbase.cpp kdenetwork/kmail/kmmsgbase.cpp
--- kdenetwork.org/kmail/kmmsgbase.cpp Thu Feb 22 02:56:42 2001
+++ kdenetwork/kmail/kmmsgbase.cpp Thu Feb 22 03:29:58 2001
@@ -366,7 +366,7 @@
{
// decode quoted printable text
for (i=str.length()-1; i>=0; i--)
- if (str[i]=='_') str[i]=' ';
+ if (charset!="iso-2022-jp" && str[i]=='_') str[i]=' ';
cstr = decodeQuotedPrintable(str);
}
else
@@ -423,6 +423,8 @@
char hexcode;
int numQuotes, i;
QString result = QString();
+ int count = 0;
+ bool Iso_2022_jp_Judgmeent = FALSE;
while (pos < latinLen)
{
cr = pos;
@@ -442,8 +444,13 @@
/* The encoded word must be limited to 75 character */
for (i = 0; i < 17; i++) if (latin[cr] == especials[i]) numQuotes++;
if (latin[cr] < 0) numQuotes++;
- /* Stop after 58 = 75 - 17 characters or at "<user@host..." */
- if (cr - start + 2 * numQuotes >= 58 || latin[cr] == 60) break;
+ if (cset == "iso-2022-jp") {
+ if (cr - start + 2 * numQuotes >= 57) break;
+ }
+ else {
+ /* Stop after 58 = 75 - 17 characters or at "<user@host..." */
+ if (cr - start + 2 * numQuotes >= 58 || latin[cr] == 60) break;
+ }
cr++;
}
if (cr < latinLen)
@@ -455,11 +462,16 @@
} else stop = cr;
while (pos < start) { result += latin[pos]; pos++; }
result += QString("=?%1?q?").arg(cset);
+ ++count;
while (pos < stop)
{
numQuotes = 0;
for (i = 0; i < 17; i++) if (latin[pos] == especials[i]) numQuotes = 1;
if (latin[pos] < 0) numQuotes = 1;
+ if (count > 1 && cset == "iso-2022-jp") {
+ Iso_2022_jp_Judgmeent = TRUE;
+ count = 0;
+ }
if (numQuotes)
{
result += "=";
@@ -470,6 +482,14 @@
if (hexcode >= 58) hexcode += 7;
result += hexcode;
} else {
+ if (Iso_2022_jp_Judgmeent == TRUE) {
+ result += "=";
+ result += 49;
+ result += (59+7);
+ result += 36;
+ result += 66;
+ Iso_2022_jp_Judgmeent = FALSE;
+ }
result += latin[pos];
}
pos++;
_______________________________________________
Kmail Developers mailing list
Kmail@master.kde.org
http://master.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic