workaround for Funambol 3.0 trailing = parser bug

git-svn-id: https://zeitsenke.de/svn/SyncEvolution/trunk@329 15ad00c4-1369-45f4-8270-35d70d36bdcd
This commit is contained in:
Patrick Ohly 2007-03-24 17:14:53 +00:00
parent 3b95164897
commit 6e698f3e0b
3 changed files with 32 additions and 5 deletions

View File

@ -338,6 +338,21 @@ SyncItem *EvolutionContactSource::createItem( const string &uid, SyncState state
vprop->removeParameter("ENCODING");
vprop->addParameter("ENCODING", "BASE64");
}
// Workaround for Funambol 3.0 parser bug:
// trailing = are interpreted as soft line break
// even if the property doesn't use QUOTED-PRINTABLE encoding.
// Avoid that situation by enabling QUOTED-PRINTABLE for
// such properties.
if (!encoding) {
char *value = vprop->getValue();
if (value &&
value[0] &&
value[strlen(value)-1] == '=') {
vprop->addParameter("ENCODING", "QUOTED-PRINTABLE");
}
}
}
vobj->setVersion("2.1");

View File

@ -1,3 +1,12 @@
BEGIN:VCARD
VERSION:3.0
NICKNAME:user17
NOTE:triggers parser bug in Funambol 3.0: trailing = is mistaken for soft line break=
FN:parserbug=
N:parserbug=
X-EVOLUTION-FILE-AS:parserbug=
END:VCARD
BEGIN:VCARD
VERSION:3.0
NICKNAME:user16

View File

@ -381,11 +381,6 @@ void VObject::fromNativeEncoding()
for (int index = propertiesCount() - 1; index >= 0; index--) {
VProperty *vprop = getProperty(index);
if (vprop->equalsEncoding(TEXT("QUOTED-PRINTABLE"))) {
// remove this, we cannot recreate it
vprop->removeParameter(TEXT("ENCODING"));
}
wchar_t *native = vprop->getValue();
// in the worst case every comma/linebreak is replaced with
// two characters and each \n with =0D=0A
@ -401,6 +396,14 @@ void VObject::fromNativeEncoding()
bool doquoted = !is_30 &&
wcsstr(native, SYNC4J_LINEBREAK) != NULL;
if (vprop->equalsEncoding(TEXT("QUOTED-PRINTABLE"))) {
// remove it, recreate if doing 2.1
vprop->removeParameter(TEXT("ENCODING"));
if (!is_30) {
doquoted = true;
}
}
// non-ASCII character encountered
bool utf8 = false;