On Aug 18, 2011, at 12:08 , Patrick Ohly wrote:
This is provided by Evolution:
This is sent to Memotoo as:
Note that the comma was not considered special by the Synthesis encoder.
My memory is a bit fuzzy: is escaping it optional in vCard 3.0 optional
and/or does this depend on whether the property is meant to be a
comma-separated list? Lukas?
For vCard 2.1, the engine only escapes when the contents is really a comma separated
For vCard 3.0, commas are always escaped.
That is, when actually generating that property normally. It seems however that
X-EVOLUTION-FILE-AS was created using the "unprocessed" mode (X-*), which does
not do any deescaping or escaping (except for lineends). So if X-EVOLUTION-FILE-AS did not
have the escape on input, it would not be reproduced with comma escapes on output.
At least it was meant to work like this, and it also does when generating X-* properties.
However when looking at the code I found that the code checking the *de*-escaping has a
bug and IMHO would have converted a sequence like "foo\,bar" into
"foo,,bar", i.e. duplicated the escaped char instead of retaining the escape. I
wonder why that double comma is not seen in the version from Evolution (after being parsed
into a syncitem, of course).
Anyway, here's a patch which fixes the deescaping bug, even if that seems not directly
related to the issue.
Still, I'd like to understand what exactly happened here. Any ideas?
From ffdaf33a39da012969d3292b885963d8bd533cae Mon Sep 17 00:00:00 2001
From: Lukas Zeller <luz(a)plan44.ch>
Date: Thu, 18 Aug 2011 18:12:31 +0200
Subject: [PATCH] engine: MIME-DIR, fixed de-escaping in
The way the code was before, a sequence like "foo\,bar" would have
been converted into "foo,,bar", i.e. duplicated the escaped char
instead of retaining the escape.
sysync/mimedirprofile.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/sysync/mimedirprofile.cpp b/sysync/mimedirprofile.cpp
index caaa262..985601e 100644
@@ -3689,7 +3689,7 @@ bool TMimeDirProfileHandler::parseValue(
if (!c) break; // half escape sequence, ignore
else if (c=='n' || c=='N') c='\n';
- else if (aOnlyDeEscLF) val+=c; // if deescaping only for \n, transfer escape
char into output
+ else if (aOnlyDeEscLF) val+='\\'; // if deescaping only for \n,
transfer this non-LF escape into output
// other escaped chars are shown as themselves
// add char