Hi Congwu,

vCard 2.1 simply cannot fold text without whitespace at all. The only workaround is to resort to Quoted-Printable (this is implemented in libsynthesis as a second pass when it detects it cannot represent a text without QP).

Now in case of B64, additional QP around it just for folding is IMHO out of question.

rfc3548 (b64) says in paragraph 2.3 that implementations such as MIME state non-b64-alphabeth characters should be ignored (otherwise, CRLF would not be allowed as well). The example in the vCard 2.1 does the folding using spaces at the beginning of subsequent b64 lines.

For pathological vCard parsers the workaround is probably to avoid folding entirely (can be done using the <nocontentfolding> remote rule option).

For parsing, detection of the end of the B64 block requires lookahead because there is no guarantee the b64 string ends in a "=" (it does not when the input string is a integer multiple of 3 bytes). If we can't distinguish folding line ends from end-of-property line ends, the only solution is to parse ahead into the next line and check if there's a colon as a sign that the entire line does not belong to the B64 string.

I'll have a look how complicated this would be to implement - it will not be trivial because the layering in the current implementation first separates properties and then parses them, and the lookahead would require reversing some of that.

Best Regards,

Lukas Zeller


On Oct 14, 2009, at 5:29 , Chen, Congwu wrote:

The bug entry: http://bugzilla.moblin.org/show_bug.cgi?id=6668

Hi, Lukas
Intel QA found a bug when testing with Mobical.net [1], it turns out there are
some misinterpreting of the line folding in vCard 2.1 spec.
As Björn Wrote:
But if this is vCard 2.1 I would say it is not 100% clear on what the correct behaviour should be. The vCard 2.1 specification together with RFC 2045
does
give a definitive answer in my opinion. Anyway some phones corrupts the
data if
we send any white space after the CRLF, and all accepts it without the white space. My recommendation in this case is for your parser to accept both
ways.
Mobical.net folds long lines in Base64 data in vCard2.1 use CRLF only
according to RFC2045.

vCard 2.1 has specified a line folding technique:
"Long lines of text can be split into a multiple-line representation using the RFC 822 "folding" technique. That is, wherever there may be linear white space (NOT simply LWSP-chars), a CRLF immediately followed by at least one
LWSP-char may instead be inserted."
Synthesis, Funambol, etc. are using this folding technique for base64 data.

My question is:
There is no linear while space in base64 encoded data, how can we folds the
line via this technique?
Is this something clear enough and accepted by most vendors? Since Mobical
mentioned some phones crash when they send CRLF followed by space?

Thanks,
Chen,Congwu

Lukas Zeller ([email protected])
-
Synthesis AG, SyncML Solutions  & Sustainable Software Concepts
[email protected], http://www.synthesis.ch





_______________________________________________
os-libsynthesis mailing list
[email protected]
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis

Reply via email to