0 votes

The VCardParser incorrectly parses the NOTE field when it is multiline, adding the extra lines as separate headers with unpredictable header keys.

The VCard should provide access to the full ordered set of fields/headers, and the parser should correctly handle multi-line fields (even unknown ones) in that if a line has no field marker then the value should be appended to the last parsed field.

by

1 Answer

0 votes
 
Best answer

VCardParser correctly processes multi-line fields.

Please send the file that is incorrectly parsed to the support email directly.
Most likely the lines in this field are incorrectly folded - there must be a white-space character on the line start for the line to be a continuation of the previous one, e.g.:

PHOTO;TYPE=JPEG;ENCODING=BASE64:
 /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgK
 CgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkL
by (297k points)
edited by
Actually - you are right.  I checked the RFC and the file indeed has incorrectly folded lines (no leading space).  The files are generated by Outlook - the world's most popular email system - so incorrect or not, I still need to parse them and using your API I cannot access the additional lines.  

My other requests still applies, it should be possible to gain access to the ordered set of lines from the file which would provide a workaround, or the parser should be more tolerant of file format anomalies.
The thing is that this is simply impossible. If they don't follow the specs there is no way to reliably distinguish line continuation from the new header. Have you reported this on MS Connect? We'll see what we can do about it in the next release.
I can post you the code I use if you like.  I am manually parsing the lines.  Continuation lines all terminate with the characters "=0D=0A=".

See below example...
----
TITLE:Communications and Marketing Manager
NOTE;CHARSET=us-ascii;ENCODING=QUOTED-PRINTABLE:Details last checked: 2/25/2014=0D=0A=
Pronounced "Shavauan"
TEL;WORK;VOICE:02 9999 9999
----
This is definitely incorrect vcf file. The latest version should handle those properly.
...