Bug 60275

Summary: When creating mailto: link, it doesnt do url encode of subject
Product: quanta Reporter: Miroslav Maiksnar <miroslav.maiksnar>
Component: generalAssignee: András Manţia <amantia>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.1.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: ULR encoding algorithm taken from the PHP spurce code

Description Miroslav Maiksnar 2003-06-23 16:51:07 UTC
Version:           3.1.1 (using KDE 3.1.1)
Installed from:     (3.0)
Compiler:          gcc version 2.95.4 20011002 (Debian prerelease)
OS:          Linux (i686) release 2.4.20-custom.1.3

When inserting email link (menu tags->other->email), when I enter subject of email, It doesn't url encode text for example when I enter subject "Do you like M&M's?", resulting link is:
<a href="mailto:someone@somewhere.com?subject=Do you like M&M's?">mail</a>
Comment 1 András Manţia 2003-06-24 11:05:43 UTC
Subject: Re:  New: When creating mailto: link, it doesnt do url encode of subject

Can you give me the correct encoding, how it should look like. I'm mainly a 
C++ developer, not a HTML one. :-(

Andras


Comment 2 Miroslav Maiksnar 2003-06-24 11:22:46 UTC
Created attachment 1877 [details]
ULR encoding algorithm taken from the PHP spurce code

I hope I didn't break any license by attaching source code of this function ;o/
Comment 3 Miroslav Maiksnar 2003-06-24 11:54:32 UTC
URL encoded line should look like this: Do+you+like+M%26M%5C%27s%3F
Comment 4 András Manţia 2003-06-24 12:45:16 UTC
Subject: quanta

CVS commit by amantia: 

Encode the subject in a mailto url [#60275].

CCMAIL: 60275-done@bugs.kde.org


  M +1 -0      ChangeLog   1.181
  M +1 -1      quanta/quantaview_slots.cpp   1.96


--- quanta/quanta/quantaview_slots.cpp  #1.95:1.96
@@ -172,5 +172,5 @@ void QuantaView::slotTagMail()
       tag += QuantaCommon::attrCase(" href=")+qConfig.attrValueQuotation+"mailto:"+mailDlg->lineEmail->text();
         if ( !QString(mailDlg->lineSubject->text()).isEmpty())
-         tag += "?subject="+mailDlg->lineSubject->text();
+         tag += "?subject="+KURL::encode_string(mailDlg->lineSubject->text());
          tag += qConfig.attrValueQuotation;
     }

--- quanta/ChangeLog  #1.180:1.181
@@ -50,4 +50,5 @@
     - don't close quanta, if the user cancelled the toolbar saving [#59952]
     - warn about existing files on rename [#60187]
+    - encode the subject in a mailto url [#60275]
 
   - new features: