mangstadt / ez-vcard

A vCard parser library for Java
Other
399 stars 92 forks source link

Support for RFC 6868 #54

Closed rfc2822 closed 8 years ago

rfc2822 commented 8 years ago

Double-quotes can't be encoded with plain VCard 3/4. This is why RFC 6868 specifies a way to encode " (and \n) using the newly introduced ^ escape character.

It might be worth a thought whether RFC 6868 could be implemented in ez-vcard (and maybe enabled by default, and/or enabled/disabled by a configuration option). At the moment, I don't know any platforms implementing RFC 6868, but users are (understandably) confused by the fact that they can't create contacts with " in fields like the address LABEL, and RFC 6868 seems the only practicable solution for this problem.

Thanks for your great work.

mangstadt commented 8 years ago

Hey rfc,

ez-vcard already supports this. It's turned off by default for write operations and turned on by default for read operations. Use the VCardWriter.setCaretEncodingEnabled method to turn it on.

VCard vcard = ...
VCardWriter writer = ...
writer.setCaretEncodingEnabled(true);
writer.write(vcard);
rfc2822 commented 8 years ago

Ah, cool. Didn't see it in the API. Thanks

mangstadt commented 8 years ago

No problem. Thank you for writing.