Fix bug #3524 ‘vCard does not decode all quoted-printable values’
authorRicardo Mones <ricardo@mones.org>
Wed, 30 Sep 2015 22:28:34 +0000 (00:28 +0200)
committerRicardo Mones <ricardo@mones.org>
Thu, 1 Oct 2015 20:08:35 +0000 (22:08 +0200)
Support vCard 2.1 variants with UTF-8 charset and/or encoding type
parameters, which were deprecated in vCard 3.0, but are currently
being used in some smartphone contact list exporters.

src/vcard.c
src/vcard.h

index 378a54dca39ecb116254db352fca43c20790af2a..514ab4ffbc615a97a28cc103536a0169d9698b44 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001-2012 Match Grun and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2001-2015 Match Grun and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 /*
  * Functions necessary to access vCard files. vCard files are used
  * by GnomeCard for addressbook, and Netscape for sending business
- * card information. Refer to RFC2426 for more information.
+ * card information. Refer to http://www.imc.org/pdi/vcard-21.txt and
+ * RFC2426 for more information.
  */
 
 #include <glib.h>
@@ -442,7 +442,9 @@ static void vcard_read_file( VCardFile *cardFile ) {
                /* g_print( "\ttype:  %s\n", tagtype ); */
                /* g_print( "\tvalue: %s\n", tagvalue ); */
 
-               if( g_utf8_collate( tagtype, VCARD_TYPE_QP ) == 0 ) {
+               if( g_utf8_collate( tagtype, VCARD_TYPE_QP ) == 0
+                   || g_utf8_collate( tagtype, VCARD_TYPE_E_QP ) == 0
+                   || g_utf8_collate( tagtype, VCARD_TYPE_CS_UTF8_E_QP ) == 0) {
                        gchar *tmp;
                        /* Quoted-Printable: could span multiple lines */
                        tagvalue = vcard_read_qp( cardFile, tagvalue );
index 8c1fcc2ad24fe3820b9281b6a9d34afb3a24de4c..cf0274e59ddfce7ce57f8a69e3e279debe8642a7 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2001-2012 Match Grun and the Claws Mail team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2001-2015 Match Grun and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 /*
  * Definitions necessary to access vCard files. vCard files are used
  * by GnomeCard for addressbook, and Netscape for sending business
- * card information. Refer to RFC2426 for more information.
+ * card information. Refer to http://www.imc.org/pdi/vcard-21.txt and
+ * RFC2426 for more information.
  */
 
 #ifndef __VCARD_H__
@@ -45,6 +45,8 @@
 #define VCARD_TAG_UID      "uid"
 
 #define VCARD_TYPE_QP      "quoted-printable"
+#define VCARD_TYPE_E_QP    "encoding=quoted-printable"
+#define VCARD_TYPE_CS_UTF8_E_QP "charset=utf-8;encoding=quoted-printable"
 
 #define        VCARD_SEP_TAG      ':'
 #define        VCARD_SEP_TYPE     ';'