Bug 56049 - wrong encoding of command line arguments
Summary: wrong encoding of command line arguments
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-17 07:59 UTC by Choe Hwanjin
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Choe Hwanjin 2003-03-17 07:59:33 UTC
Version:            (using KDE KDE 3.1)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.2 20020903 (HancomLinux 3.0 3.2-7hl) 
OS:          Linux

When I run Kmail on command line like below:

kmail --composer "some_korean_text" \<test@test.com\>

kmail show wrong encoded text(not readable) in "To" lineedit widget.
I think kmail need patch below

--- kdenetwork-3.1/kmail/main.cpp.orig  2003-03-17 15:42:18.000000000 +0900
+++ kdenetwork-3.1/kmail/main.cpp       2003-03-17 15:43:30.000000000 +0900
@@ -180,7 +180,7 @@
      if (strncasecmp(args->arg(i),"mailto:",7)==0)
        to += args->arg(i);
      else
-       to += args->arg(i);
+       to += QString::fromLocal8Bit(args->arg(i));
      mailto = true;
   }
Comment 1 Ingo Klöcker 2003-03-17 17:36:31 UTC
KMail expects the email address to be encoded according to RFC 2047 (MIME, Message 
Header Extensions for Non-ASCII Text). But we will consider your proposal to make it work for 
email addresses in local encoding. Have you verified that the fix you propose really fixes the 
problem? 
 
Comment 2 Choe Hwanjin 2003-03-18 02:52:04 UTC
It is actually right that email address should be encoded according to RFC2047. But It's about command  
line arguments. No one want to type email address like this on command line: 
 
 $ kmail --composer =?euc-kr?B?xde9usau?= \<test@test.com\> 
 
instead: 
 
 $ kmail --composer "human readable string" \<test@test.com\> 
 
If the command line args are composed of US-ASCII (correctly encoded email addresses), 
QString::fromLocal8Bit() do nothing. So this works in either cases. 
Encoded string is needed only when email is actually sent. If KMail encode the mail  
address of "To" text entry, we will get correctly encoded email. 
I think program should do encoding job not human. 
 
Comment 3 Ingo Kl 2003-03-19 00:36:48 UTC
Subject: KDE_3_1_BRANCH: kdenetwork/kmail

CVS commit by kloecker: 

Fix bug 56049: wrong encoding of command line arguments
Fix by Choe Hwanjin <hjchoe@hancom.com>.

Furthermore handle mailto: URLs a little bit more correctly by removing the 'mailto:'. Of course, the real fix will be to completely parse the mailto: URL.

CCMAIL: 56049-fixed@bugs.kde.org


  M +2 -2      main.cpp   1.166.2.3


--- kdenetwork/kmail/main.cpp  #1.166.2.2:1.166.2.3
@@ -179,7 +179,7 @@ int KMailApplication::newInstance()
       to += ", ";
      if (strncasecmp(args->arg(i),"mailto:",7)==0)
-       to += args->arg(i);
+       to += args->url(i).path();
      else
-       to += args->arg(i);
+       to += QString::fromLocal8Bit( args->arg(i) );
      mailto = true;
   }