Bug 72380 - vCards with utf-8 quoted printable are displayed incorrect
Summary: vCards with utf-8 quoted printable are displayed incorrect
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kab3
Classification: Miscellaneous
Component: general (show other bugs)
Version: 3.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Tobias Koenig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-11 11:29 UTC by Robert Entner
Modified: 2009-08-05 16:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Problematic .vcf file, generated by Ximian Evolution (562 bytes, text/plain)
2004-02-27 11:51 UTC, Robert Entner
Details
Zipped version of a problematic .vcf file including utf8 and quoted printable exported with ximian evoltuion (356 bytes, application/octet-stream)
2004-02-27 11:54 UTC, Robert Entner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Entner 2004-01-11 11:29:03 UTC
Version:           3.1 (using KDE 3.1.94 (3.2 Beta 2), compiled sources)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:          Linux (i686) release 2.4.21-166-athlon

When I export my contacts from Ximian Evolution to a .vcf File, I get for example the following entry:

BEGIN:VCARD
VERSION:2.1
X-EVOLUTION-FILE-AS;CHARSET=UTF-8;QUOTED-PRINTABLE:H=C3=B6ssinger, Andreas
FN;CHARSET=UTF-8;QUOTED-PRINTABLE:Andreas H=C3=B6ssinger
N;CHARSET=UTF-8:Hössinger;Andreas
EMAIL;INTERNET:hoessinger@irgendeineadressediesnichtgibt.at
X-EVOLUTION-LAST-USE:2003-12-17
X-EVOLUTION-USE-SCORE:16.171589
CATEGORIES:IuE
UID:pas-id-3EF2D04D00000003
END:VCARD

When I import it in KAddressbook the name of the person is displayed korrectly in the contact list (with an umlaut o) and in the summary his name is displayed as: Andreas H=C3=B6ssinger

LG,
Burt
Comment 1 Tobias Koenig 2004-01-11 18:22:25 UTC
Subject: kdelibs/kabc/vcardparser

CVS commit by tokoe: 

Fixed the handling of vCard 2.1 with quoted-printable and charset=utf-8.
That fixes #72380.

CCMAIL:72380-done@bugs.kde.org


  M +14 -1     vcardparser.cpp   1.12


--- kdelibs/kabc/vcardparser/vcardparser.cpp  #1.11:1.12
@@ -73,6 +73,12 @@ VCard::List VCardParser::parseVCards( co
             QStringList pair = QStringList::split( '=', params[i] );
             if ( pair.size() == 1 ) {
+              // correct the fucking 2.1 'standard'
+              if ( pair[0].lower() == "quoted-printable" ) {
+                pair[0] = "encoding";
+                pair[1] = "quoted-printable";
+              } else {
                 pair.prepend( "type" );
             }
+            }
             //This is pretty much a faster pair[1].contains( ',' )...
             if ( pair[1].find( ',' ) != -1 ) { // parameter in type=x,y,z format
@@ -93,5 +99,12 @@ VCard::List VCardParser::parseVCards( co
           else if ( vCardLine.parameter( "encoding" ).lower() == "quoted-printable" )
             KCodecs::quotedPrintableDecode( input, output );
-          vCardLine.setValue( output );
+
+          if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) {
+            vCardLine.setValue( QString::fromUtf8( output.data(), output.size() ) );
+          } else {
+            vCardLine.setValue( QString::fromAscii( output.data(), output.size() ) );
+          }
+        } else if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) {
+          vCardLine.setValue( QString::fromUtf8( value.ascii() ) );
         } else
           vCardLine.setValue( value.replace( "\\n", "\n" ) );


Comment 2 Robert Entner 2004-02-27 11:50:01 UTC
The problem still persists. I attached a .vcf file for testing.
Comment 3 Robert Entner 2004-02-27 11:51:04 UTC
Created attachment 4912 [details]
Problematic .vcf file, generated by Ximian Evolution
Comment 4 Robert Entner 2004-02-27 11:54:15 UTC
Created attachment 4913 [details]
Zipped version of a problematic .vcf file including utf8 and quoted printable exported with ximian evoltuion
Comment 5 Tobias Koenig 2004-02-27 14:29:27 UTC
On Fri, Feb 27, 2004 at 10:54:16AM -0000, Robert Entner wrote:
Hi Robert,

> ------- Additional Comments From kde mail1 entner net  2004-02-27 11:54 -------
> Created an attachment (id=4913)
>  --> (http://bugs.kde.org/attachment.cgi?id=4913&action=view)
> Zipped version of a problematic .vcf file including utf8 and quoted printable
> exported with ximian evoltuion
I can import this vCard without problem with KAddressBook/kdelibs from
CVS HEAD. It's really fixed.

Ciao,
Tobias
Comment 6 MartinG 2008-08-20 10:14:36 UTC
I tried the attached vcard in comment #4, and it imported correctly when using the default resource, but if I import to my imap resource (through kmail), the non-ascii characters are garbled (by two boxes). 

Any hints on how to fix this would be greatly appreciated as a majority of my contacts have non-ascii characters. 

kdepim-3.5.9-10.fc9.i386
Kontact: 1.2.9
KAddressBook: 3.5.9
KMail: 1.9.9
Comment 7 Tobias Koenig 2009-08-05 16:03:37 UTC
The development of the old KAddressBook will be discontinued for KDE 4.4.
Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product.