[WIP] Adds support for vCard 2.1#389
[WIP] Adds support for vCard 2.1#389caugner wants to merge 4 commits intokewisch:masterfrom caugner:187-support-vcard-2.1
Conversation
|
Awesome!! @caugner |
|
Glad to see you are working on it, life saver! I tried testing it, but am getting "unsupported vCard version" with a vCard 4.0. Taking a brief look at the code, it look like your switch statement only handles 3.0 and 2.1 (though it could be intentional in that specific spot). |
|
@tasn Can you share the vCard 4.0 which triggered the error? It sounds as if the vCard combines properties of vCard 3 and 4, because this switch statement should only be evaluated for vCards other than 4.0: |
| ); | ||
| } | ||
|
|
||
| var debug = line.includes("37.386013"); |
There was a problem hiding this comment.
| var debug = line.includes("37.386013"); |
|
Apologies for the noise! I guess you can ignore my comment. The entry for reference: |
|
regarding [1] there are two old issues at nextcloud contacts & server with some example ENCODING=QUOTED-PRINTABLE characters of danish and german users in case you want to extend your test case vcard21.vcf |
|
I guess this was accidentally closed because of the deletion of |
This commit adds full support for parsing vCard 2.1 format, based on the work from PR kewisch#389. Key features implemented: - New vcard21 design set with proper text escaping rules - Text type that escapes backslash, semicolon, and comma but does not treat commas as multi-value separators (vCard 2.1 uses single values) - Support for vCard 2.1 specific parameters (encoding, charset) - Version detection logic to automatically switch to vcard21 parser when VERSION:2.1 is encountered - Comprehensive test coverage with vcard21.vcf and vcard21.json fixtures - All existing tests continue to pass The implementation correctly handles the key differences between vCard 2.1 and later versions: - Escape sequences: only backslash, semicolon, and comma need escaping - No comma-separated multi-value properties - Semicolons still used for structured values - Support for BASE64 encoding parameter (instead of 'b')
|
I am trying to revive this in #958 if anyone wants to help. Still quite rough and not ready for review, I will remove the WIP mark when it is ready. |
Fixes #187.
QUOTED-PRINTABLEinline encoding [cf. Section 2.1.2].CRLF(but instead literally as "\", followed by "n" or "N").COMMAas a multi-value separator [all values are single values].SEMICOLONmust also be backslash escaped in vCard 2.1. "in a component of a compound property" [cf. Section 2.1.3]VERSIONto be "2.1" [cf. Section 2.6.6].CHARSETtype parameter [and default toASCII, cf. 2.1.6].TYPE=andENCODING=, cf. 2.1.2].TYPEofLOGO[cf. 2.5.3.1],PHOTO[cf. 2.2.3.1] andSOUND[cf. 2.6.3.1] as defined by the spec [e.g.GIF].ENCODINGparameter [and default to7-bit, cf. 2.1.5].PCStype parameter value forTEL[from vCard 3.0].CATEGORIES,CLASS,NICKNAME,PRODIDandSORT-STRING[from vCard 3.0].NandFN[Note:Nis only required for writers, not for readers, cf. 2.2.2].VERSIONis also required in vCard 2.1 [cf. [4] and 2.6.6].COMMAto separateGEOvalues [cf. 2.4.6 versusSEMICOLONin vCard 3.0]