Bug 41018 - KAddressBook doesn't support "send mail" with Cyrillic names correctly
Summary: KAddressBook doesn't support "send mail" with Cyrillic names correctly
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: general (show other bugs)
Version: 3.0
Platform: Mandrake RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Ingo Klöcker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-15 06:18 UTC by Vadim Plessky
Modified: 2009-12-06 16:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim Plessky 2002-04-14 11:11:13 UTC
(*** This bug was imported into bugs.kde.org ***)

Package: kaddressbook
Version: 3.0 (using KDE 3.0.0 )
Severity: normal
OS: Linux (i686) release 2.4.17-19mdk
Installed from: gcc version 2.96 (mandrake Linux 8.3 2.96-0.78mdk)

try to add contact:
 ÃÂýôÃÂõù ÃÂòðýþò <andrey@ivanov.ru>
to KAddressBook and double-click on entry (or press Mail button on Toolbar)
You will get KMail wth ?????? ?????? <andrey@ivanov.ru> address in the To: 
filed.
 
At the same time you can drag'n'drop entry to new message in Kmail and name 
will be displayed correctly (as  ÃÂýôÃÂõù ÃÂòðýþò )
Hope this can be corrected for upcoming KDE 3.0.1

BR
-- 

Vadim Plessky
Comment 1 Tobias Koenig 2002-09-26 15:29:46 UTC
Can you reproduce this bug with current version from CVS HEAD?  I guess it's a bug in kmail or the invokeMailer() API  Ciao, Tobias 
Comment 2 Ingo Klöcker 2002-09-26 23:00:28 UTC
Subject: Re:  KAddressBook doesn't support "send mail" with Cyrillic names correctly

I can reproduce this with a Cyrillic name (Георгий) and with a Chinese 
name (立兰) with CVS HEAD. Let's see if the names survive bugzilla.

Comment 3 Vadim Plessky 2002-09-27 11:13:55 UTC
Subject: Re:  KAddressBook doesn't support "send mail" with Cyrillic names correctly

On Friday 27 September 2002 1:00 am, Ingo "Klöcker" wrote:
|  ------- You are receiving this mail because: -------
|  You reported the bug, or are watching the reporter.
|
|  http://bugs.kde.org/show_bug.cgi?id=41018
|
|  ------- Additional Comments From kloecker@kde.org  2002-09-26 23:00
| ------- Subject: Re:  KAddressBook doesn't support "send mail" with
| Cyrillic names correctly
|
|  I can reproduce this with a Cyrillic name (ÐеоÑгий) and with a
| Chinese name (ç«å°) with CVS HEAD. Let's see if the names survive
| bugzilla.

No, mail (Cyrillic part) hasn't survived.

Lookig into mail header which I received:
--------------------------------------------
From bugzilla@ktown.kde.org  Fri Sep 27 01:00:34 2002
Return-Path: <bugzilla@ktown.kde.org>
Delivered-To: lucy-ples@mtu-net.ru
X-Recipient: lucy-ples@mtu-net.ru
Received: from Hueymiccailhuitl.mtu.ru (titlaltotonametli.mtu.ru 
[195.34.32.121])
        by huitzilopochtli.mtu.ru (Postfix) with ESMTP id B6B261D0822
        for <lucy-ples@mtu-net.ru>; Fri, 27 Sep 2002 01:00:34 +0400 (MSD)
        (envelope-from bugzilla@ktown.kde.org)
Received: from ktown.kde.org (kde.informatik.uni-kl.de [131.246.103.200])
        by Hueymiccailhuitl.mtu.ru (Postfix) with SMTP id AB30319AF78
        for <lucy-ples@mtu-net.ru>; Fri, 27 Sep 2002 01:00:33 +0400 (MSD)
        (envelope-from bugzilla@ktown.kde.org)
Received: (qmail 4815 invoked by uid 1109); 26 Sep 2002 21:00:31 -0000
Date: 26 Sep 2002 21:00:31 -0000
Message-ID: <20020926210031.4814.qmail@ktown.kde.org>
From: Ingo "Klöcker" <kloecker@kde.org>
To: lucy-ples@mtu-net.ru
Sender: owner@bugs.kde.org
Reply-To: bugmail@bugs.kde.org
Subject: [Bug 41018] KAddressBook doesn't support "send mail" with Cyrillic 
names correctly         
X-Bugzilla-URL: http://bugs.kde.org/ 
X-Bugzilla-Reason: Reporter     
Status: R 
X-Status: N
X-KMail-EncryptionState:  
X-KMail-SignatureState:  
------------------------------------------------

--> there is no encoding information at all!
I suggest it's a big in Bugzilla.

Test word in Cyrillic: "Кириллица" 

Comment 4 Tobias Koenig 2003-04-02 10:45:44 UTC
*** Bug 56695 has been marked as a duplicate of this bug. ***
Comment 5 Tobias Koenig 2003-04-11 16:52:14 UTC
*** Bug 57094 has been marked as a duplicate of this bug. ***
Comment 6 Stefan Paletta 2004-08-24 06:59:11 UTC
The situation has essentially reversed as of (at least) KDE 3.3.
Sending mail to a contact from within KAddressbook now yields the correct name in KMail.
Drag and drop of a contact from KAddressbook to the address widget in KMail inserts the filename of the temporary .vcf file.
Comment 7 Tobias Koenig 2005-01-07 16:50:20 UTC
CVS commit by tokoe: 

Encode email address to support non-latin1 characters.

CCMAIL:94905-done@bugs.kde.org, 41018-done@bugs.kde.org


  M +36 -2     kapplication.cpp   1.697


--- kdelibs/kdecore/kapplication.cpp  #1.696:1.697
@@ -73,4 +73,5 @@
 #include <kprotocolinfo.h>
 #include <kkeynative.h>
+#include <kmdcodec.h>
 
 #if defined Q_WS_X11
@@ -2302,5 +2303,25 @@ void KApplication::invokeMailer(const QS
 // on win32, for invoking browser we're using win32 API
 // see kapplication_win.cpp
-void KApplication::invokeMailer(const QString &to, const QString &cc, const QString &bcc,
+
+static QString simpleRFC2047Encode( const QString &email )
+{
+  int end = email.findRev( '>' );
+
+  if ( end == -1 ) // no part to encode
+    return email;
+
+  int index = end - email.length() - 1;
+  int begin = email.findRev( '<', index );
+
+  QString address = email.mid( begin + 1, end - begin - 1 );
+  QString name = email.left( begin ).stripWhiteSpace();
+
+  QString result = QString( "=?utf8?b?%1?= <%2>" )
+                   .arg( KCodecs::base64Encode( name.utf8(), false ), address );
+
+  return result;
+}
+
+void KApplication::invokeMailer(const QString &_to, const QString &cc, const QString &bcc,
                                 const QString &subject, const QString &body,
                                 const QString & /*messageFile TODO*/, const QStringList &attachURLs,
@@ -2315,8 +2336,21 @@ void KApplication::invokeMailer(const QS
    QString command = config.readPathEntry("EmailClient");
 
+   QString to;
    if (command.isEmpty() || command == QString::fromLatin1("kmail")
-       || command.endsWith("/kmail"))
+       || command.endsWith("/kmail")) {
      command = QString::fromLatin1("kmail --composer -s %s -c %c -b %b --body %B --attach %A -- %t");
 
+     if ( !_to.isEmpty() )
+     {
+       const QStringList tos = QStringList::split( ',', _to );
+       for (QStringList::ConstIterator it = tos.begin(); it != tos.end(); ++it) {
+         to += simpleRFC2047Encode( *it ) + ", ";
+       }
+
+       to.truncate( to.length() - 2 ); // strip last commata
+     }
+   } else
+    to = _to;
+
    if (config.readBoolEntry("TerminalClient", false))
    {