[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    PATCH: Fwd: Bug#19440: KMail and Japanese.
From:       Michael =?iso-8859-1?q?H=E4ckel?= <Michael () Haeckel ! Net>
Date:       2001-01-31 11:03:13
[Download RAW message or body]

Hi,

can someone (Lars?) please examine the kdelibs part of this posting.
For me that change didn't help to display japanese with qt-2.2.3, or do I 
need qt-copy for that?

Regards,
Michael Häckel

----------  Forwarded Message  ----------
Subject: Bug#19440: KMail and Japanese.
Date: 31 Jan 2001 04:13:33 -0000
From: toyohiro@ksmplus.com
To: submit@bugs.kde.org


Package: kmail
Version: cvs, Jan 29 2001
Severity: wishlist

 OS Debian Gnu/Linux 2.2 (potato)

 I got the these files from CVS server at Jan 29 2001,
 (qt-copy , kdesupport , kdelibs , kdebase , kdenetwork)
 and used kde-i18n-ja-2.1-beta2.tar.bz2( Message File) .

 I compiled these files and tested about Japanese Message.

 I tried to make a few patch for header charset which used in Japan.

 Please examine it.

   I am sorry , and The explanation might be insufficient.
   Because I speak english a little.

(A) Please execute kcontrol.

    Fig-1  http://www.ksmplus.com/~toyohiro/kde2.1/kcon1.gif
    Please select Personalization -> Country & Language
      Country  :  Asia & Oceania -> "Japan(jp)"
      Language :  "Japanese(ja)"
      Charset  :  "jisx0208.1983-0"

    Please click "Apply" button and "OK" button and File -> Quit.
    Fig-2  http://www.ksmplus.com/~toyohiro/kde2.1/kcon2.gif

    Please execute kcontrol again. The message did not display in Japanese.
    Fig-3  http://www.ksmplus.com/~toyohiro/kde2.1/kcon3.gif

    Please apply below patch and install to $KDE/share/config/charsets.
    and execute kcontrol again. The message displayed in Japanese.
    Fig-4  http://www.ksmplus.com/~toyohiro/kde2.1/kcon4.gif

$cd SOURCES/kdelibs/kdecore
$diff -u charsets.config.orig charsets.config
--- charsets.config.orig        Tue Jan 30 11:20:22 2001
+++ charsets.config     Tue Jan 30 11:22:39 2001
@@ -68,6 +68,13 @@
 x-cp-1257=cp 1257
 tis620=iso 8859-11
 tis-620=iso 8859-11
+jisx0201.1976-0=eucjp
+jisx0208.1983-0=eucjp
+jisx0208.1990-0=eucjp
+jisx0208.1997-0=eucjp
+jisx0212.1990-0=eucjp
+jisx0213.2000-1=eucjp
+jisx0213.2000-2=eucjp
 windows-874=iso 8859-11
 windows874=iso 8859-11
 x-windows-874=iso 8859-11

(B) Please eucjp and sjis and iso2022jp files save to $HOME/Mail

    The files of eucjp , sjis and iso2022jp is in
    http://www.ksmplus.com/~toyohiro/kde2.1/eucjp
    http://www.ksmplus.com/~toyohiro/kde2.1/sjis
    http://www.ksmplus.com/~toyohiro/kde2.1/iso2022jp

    File of eucjp is raw mail data which used "eucjp" mail header charset.
    File of sjis  is raw mail data which used "shift_jis" .
    File of iso2022jp is raw mail data which used "iso-2022-jp" .

    and Please see also
    Fig-0 http://www.ksmplus.com/~toyohiro/kde2.1/japanese.gif

 (B-1) EUCJP charset.
    Please execute kmail and select eucjp in folder.
    The message displayed in Japanese. It is very fine.
    Fig-1 http://www.ksmplus.com/~toyohiro/kde2.1/kmail1.gif

 (B-2) SJIS charset.
    Please select sjis in folder.
    The message did not display in Japanese.
    Fig-2 http://www.ksmplus.com/~toyohiro/kde2.1/kmail2.gif

    Please apply below patch and re-compile and execuete kmail again.
    Please select sjis in folder, the message displayed in Japanese.
    Fig-3 http://www.ksmplus.com/~toyohiro/kde2.1/kmail3.gif

    I think , When QT-2.2.4 is released , This patch is not necessary.
    Because another person reported to Trolltech about QTextCodec.

diff -ur kmail.orig/kmmsgbase.cpp kmail/kmmsgbase.cpp
--- kmail.orig/kmmsgbase.cpp    Wed Jan  3 00:30:16 2001
+++ kmail/kmmsgbase.cpp Tue Jan 30 12:04:37 2001
@@ -372,6 +372,9 @@
        // decode base64 text
        cstr = decodeBase64(str);
       }
+#if QT_VERSION < 224
+      if(QString(charset).lower() == "shift_jis" ||
+                              QString(charset).lower() == "shift-jis" )
+          charset ="sjis"; // toyo
+#endif
       QTextCodec *codec = codecForName(charset);
       if (!codec) codec = codecForName(KGlobal::locale()->charset());
       if (codec) str = codec->toUnicode(cstr);

diff -ur kmail.orig/kmreaderwin.cpp kmail/kmreaderwin.cpp
--- kmail.orig/kmreaderwin.cpp  Fri Jan 26 06:46:28 2001
+++ kmail/kmreaderwin.cpp       Tue Jan 30 13:00:58 2001
@@ -518,6 +518,8 @@
         encoding = msgPart.charset();
       }
     }
+#if QT_VERSION < 224
+    if( encoding.lower() == "shift_jis" || encoding.lower() == "shift-jis" )
+      encoding = "sjis"; // toyo
+#endif
     if (encoding.isEmpty())
       encoding = "iso8859-1";
     mCodec = KMMsgBase::codecForName(encoding);

 (B-3) ISO-2022-JP charset.
   Please select iso2022jp in folder.
   The messages did not display in Japanese.
   Fig-4 http://www.ksmplus.com/~toyohiro/kde2.1/kmail4.gif

   Please apply below patch and re-compile and execuete kmail again.
   Please select iso2022jp in folder, the message displayed in Japanese.
   Fig-4 http://www.ksmplus.com/~toyohiro/kde2.1/kmail5.gif

diff -ur kmail.orig/kmmessage.cpp kmail/kmmessage.cpp
--- kmail.orig/kmmessage.cpp    Tue Jan 23 17:11:30 2001
+++ kmail/kmmessage.cpp Tue Jan 30 12:07:56 2001
@@ -255,7 +255,10 @@
   resultPos = (char*)result.data();
   if (strPos) for (; (ch=*strPos)!='\0'; strPos++)
   {
-    if ((ch>=' ' || ch=='\t' || ch=='\n' || ch<='\0')
+//  Mail header charset(iso-2022-jp) is using all most E-mail system in
 Japan. +//  ISO-2022-JP code consists of ESC(0x1b) character and 7Bit
 character which +//  used from '!' character to  '~' character.  toyo
+    if ((ch>=' ' || ch=='\t' || ch=='\n' || ch<='\0' || ch == '\033' )
        && !(ch=='>' && aStr.mid(strPos-aStr.data()-1,6)=="\n>From"))
       *resultPos++ = ch;
   }

   When quotedHTML function by the "ISO-2022-JP" character execute before
   mCodec-toUnicode function.
   quotedHTML function mistake. because the "ISO-2022-JP" character which
   included '<' ,'>' , '&' and ...  character.

diff -ur kmail.orig/kmreaderwin.cpp kmail/kmreaderwin.cpp
--- kmail.orig/kmreaderwin.cpp  Fri Jan 26 06:46:28 2001
+++ kmail/kmreaderwin.cpp       Tue Jan 30 13:00:58 2001
@@ -904,6 +907,12 @@
     } // if (!pgpMessage) then the message only looked similar to a pgp
 message else htmlStr = mCodec->toUnicode(quotedHTML(aStr));
   }
+//  Mail header charset(iso-2022-jp) is using all most E-mail system in
 Japan. +//  ISO-2022-JP code consists of ESC(0x1b) character and 7Bit
 character which +//  used from '!' character to  '~' character.
+//  JIS7 is header charset of iso-2022-jp.  toyo
+  else if( QString(mCodec->name()) == "JIS7" )
+    htmlStr += quotedHTML(mCodec->toUnicode(aStr));
   else htmlStr += mCodec->toUnicode(quotedHTML(aStr));
   mViewer->write(htmlStr);
 }

(C) Please get the addressbook file and save to
    $HOME/.kde/share/apps/addressbook.

    addressbook file is in http://www.ksmplus.com/~toyohiro/kde2.1

    Please execute kmail and push AddressBook button.
    Fig-1  http://www.ksmplus.com/~toyohiro/kde2.1/addressbook.gif

    Please Composer button -> click "To:" field .
    and press Control-Key + Left-arrow-Key and display the contents
    of addressbook.  The messages did not display in Japanese.
    Fig-2  http://www.ksmplus.com/~toyohiro/kde2.1/composer1.gif

    Please apply below patch and re-compile and execuete kmail again.
    Please Composer button -> click "To:" field .
    and press Control-Key + Left-arrow-Key and display the contents
    of addressbook.  The messages displayed in Japanese.
    Fig-3  http://www.ksmplus.com/~toyohiro/kde2.1/composer2.gif

diff -ur kmail.orig/kmcomposewin.cpp kmail/kmcomposewin.cpp
--- kmail.orig/kmcomposewin.cpp Sat Jan 27 04:31:57 2001
+++ kmail/kmcomposewin.cpp      Tue Jan 30 12:14:33 2001
@@ -2427,7 +2427,8 @@

   n=0;
   if (!KMAddrBookExternal::useKAB())
-    for (QString a=adb.first(); a; a=adb.next())
+    for (QString a=QString::fromLocal8Bit(adb.first())
+                      ; a; a=QString::fromLocal8Bit(adb.next()))
       {
        if (QString(a).find(s,0,false) >= 0)
          {

Best Regards,
Toyohiro <toyohiro@ksmplus.com>


(submitted via bugs.kde.org)

_______________________________________________
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