-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Don't write unnecessary ";" at end of structured properties #57
Comments
Is there a typo in your first example? Should those commas be semi-colons? Commas and semi-colons are treated differently by the For example, the following property has two prefixes:
The first example you gave technically translates as a list of family names. According to the specification, it is not possible to have more than one family name, so iCloud may be treating the comma characters as normal characters, which is why iCloud is using "My Group,,,," as the group name. What happens when you pass |
You're right, this is a typo. I have passed a |
Fixed in e2a4dd3. Call VCard vcard = new VCard();
StructuredName n = new StructuredName();
n.setFamily("GroupName");
vcard.setStructuredName(n);
VCardWriter writer = new VCardWriter(System.out, VCardVersion.V3_0);
writer.setTargetApplication(TargetApplication.ICLOUD);
writer.write(vcard);
writer.close(); Output:
Thank you for reporting this. |
Thanks, but one question: As far as I understand it, the trailing |
They are now trimmed by default. This setting can be changed by calling "VCardWriter.setIncludeTrailingSemicolons()". Removed "TargetApplication.ICLOUD". The large list of files in this commit is due to the fact that the "VCardPropertyScribe.writeText()" signature was changed. #57
The example you gave in your first post isn't quite accurate.
The reason why there is no trailing semicolon in this example is that there are no more components after the "Esq." component. "Esq." is the "suffix" component, which is the last one. The formal grammar in the vCard 3.0 spec does state that trailing semicolons are optional:
And the vCard 2.1 spec gives an example without the trailing semi-colons:
However, vCard 4.0 requires all four semicolons to be there:
From a performance perspective, the better approach would be to trim the semicolons, since it reduces the size of the vCard file. Trailing semicolons are now trimmed by default for 2.1 and 3.0 vCards. I removed |
Yes, this was my first thought. Thank you very much for digging into this and providing this enhancement! |
No problem. Thanks for bringing the issue to my attention! |
When playing around with iCloud, I have found out that they use the whole line of the structured name (
N
) as the display name for groups. So, this group:will be shown as "My Group,,,,". While this is clearly an iCloud bug, I wonder whether it might be possible to just generate the actually used components, for example
N:My Group
instead ofN:My Group,,,,
when only the family name is set. See also the first example in RFC 2426 3.1.2 where the Honorific Suffixes are left out without a trailing;
:instead of
This should be applicable to other structured fields too and could reduce the complexity (and size) of generated VCards.
The text was updated successfully, but these errors were encountered: