trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2016

Re: TQString::fromUtf8 vs TQString::fromLatin1 [possible bug in parseVCard]

From: deloptes <deloptes@...>
Date: Fri, 25 Mar 2016 01:58:54 +0100
Hi all,

after some testing I suspect the problem in or around the parseVCard somehow
creating.
 
The phones report in vcard2.1. It is converted by syncevolution to v3 and
passed to the plugin.
The attached file shows the output of the syncevolution backend (tdepim).

addressbook: TDE addressbook ENTRY BEFORE - prints std::string item (the
vCard)

        SE_LOG_DEBUG(getDisplayName(), "TDE addressbook ENTRY BEFORE
\n%s\n",item.c_str() );

        Überdrüber OK

addressbook: TDE addressbook ENTRY FROM UTF - is the std::string value
converted to TQString via fromUtf8 as discussed in previous posts

        TQString input = TQString::fromUtf8(item.data(),item.size());
        std::string input_str(input.utf8(),input.utf8().length());
        SE_LOG_DEBUG(getDisplayName(), "TDE addressbook ENTRY FROM UTF
\n%s\n",input_str.c_str() );

        Überdrüber OK

addressbook: TDE addressbook ENTRY AFTER is the output of addressee after
converter.parseVCard(input) is called and converted to std::string

        TDEABC::Addressee addressee = converter.parseVCard(input);

/* DEBUG */
        TQString data;
        if (m_type == TDEPIM_CONTACT_V21 )
                data = converter.createVCard(addressee, TDEABC::VCardConverter::v2_1);
        else
                data = converter.createVCard(addressee, TDEABC::VCardConverter::v3_0);
        std::string data_str(data.utf8(),data.utf8().length());

        SE_LOG_DEBUG(getDisplayName(), "TDE addressbook ENTRY AFTER
\n%s\n",data_str.c_str() );

I could reproduce something similar in a test program by

        std::string teststr(input.utf8(),input.utf8().length());
        std::cout << teststr << "\n";

result NOK

This however does not explain the above problem as I see the broken äöü in
the AddressBook in TDE. This must  be coming from parseVCard as after this
addressee is added to the AddressBook.

This is consistent BTW with my experience with KDE3 and opensync, where I
had same problems, but never had the balls to confront them.

However this works in my test program

        std::string teststr(newItem.ascii());
        std::cout << teststr << "\n";

and this contradicts the logic of ascii all äöü are there

regards
======================================================
TEST 3
======================================================

[2016-03-25 00:28:52.216] addressbook: adding "Test1 Überdrüber"
[2016-03-25 00:28:52.216] addressbook: TDE addressbook ENTRY BEFORE 
BEGIN:VCARD 
VERSION:3.0 
PRODID:-//Synthesis AG//NONSGML SyncML Engine V3.4.0.47//EN 
REV:20100118T224646Z 
N:Überdrüber;Test1;;; 
FN:Test1 Überdrüber 
TITLE: 
ORG:;;; 
TEL:+xxxxxxxxxxxxx
EMAIL: 
URL: 
ADR:;;;;;; 
BDAY: 
NOTE: 
PHOTO;TYPE=unknown;VALUE=binary: 
END:VCARD
[2016-03-25 00:28:52.216] addressbook: TDE addressbook ENTRY FROM UTF 
BEGIN:VCARD 
VERSION:3.0 
PRODID:-//Synthesis AG//NONSGML SyncML Engine V3.4.0.47//EN 
REV:20100118T224646Z 
N:Überdrüber;Test1;;; 
FN:Test1 Überdrüber 
TITLE: 
ORG:;;; 
TEL:+xxxxxxxxxxxxx
EMAIL: 
URL: 
ADR:;;;;;; 
BDAY: 
NOTE: 
PHOTO;TYPE=unknown;VALUE=binary: 
END:VCARD
[2016-03-25 00:28:52.217] addressbook: TDE addressbook ENTRY AFTER 
BEGIN:VCARD 
FN:Test1 �berdr�ber 
N:�berdr�ber;Test1;;; 
PRODID:-//Synthesis AG//NONSGML SyncML Engine V3.4.0.47//EN 
REV:2010-01-18T22:46:46Z 
TEL:+xxxxxxxxxxxxx
UID:bpYUBW2Ptc 
VERSION:3.0 
END:VCARD