Comments (7)
The example you gave in your first post isn't quite accurate.
N:Public;John;Quinlan;Mr.;Esq.
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:
;For name="N"
;This type MUST be included in a vCard object.
param = text-param
; Text parameters allowed
value = n-value
n-value = 0*4(text-value *("," text-value) ";")
text-value *("," text-value)
; Family; Given; Middle; Prefix; Suffix.
; Example: Public;John;Quincy,Adams;Reverend Dr. III
And the vCard 2.1 spec gives an example without the trailing semi-colons:
N:Veni, Vidi, Vici;The Restaurant.
However, vCard 4.0 requires all four semicolons to be there:
N-value = list-component 4(";" list-component)
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 TargetApplication.ICLOUD
and added a method to VCardReader
that lets you adjust this setting if the consumer you're targeting requires something specific.
See commits 04cd767 and 882ee75.
from ez-vcard.
Is there a typo in your first example? Should those commas be semi-colons?
Commas and semi-colons are treated differently by the N
property. Commas are used as delimiters when a component has more than one item in it.
For example, the following property has two prefixes:
N:Public;John;Quinlan;Mr.,Dr.;Esq.;
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 N:GroupName;;;;
into iCloud? Does iCloud include the trailing semicolons in the group name?
from ez-vcard.
What happens when you pass N:GroupName;;;; into iCloud? Does iCloud include the trailing semicolons in the group name?
You're right, this is a typo. I have passed a StructuredName
which just family name set into iCloud and the result was a group called Name,,,,
or Name;;;;
. I don't remember anymore, but I guess it was "Name;;;;" (because this was the full N
in the uploaded VCard). When doing vCard.addExtendedProperty("N", fn);
instead, it works.
from ez-vcard.
Fixed in e2a4dd3.
Call VCardWriter.setTargetApplication()
like so:
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:
BEGIN:VCARD
VERSION:3.0
PRODID:ez-vcard 0.9.11-SNAPSHOT
N:GroupName
END:VCARD
Thank you for reporting this.
from ez-vcard.
Thanks, but one question: As far as I understand it, the trailing ;
s are unnecessary in any case, so wouldn't it best to always remove them (and not only for a specific target application)?
from ez-vcard.
From a performance perspective, the better approach would be to trim the semicolons, since it reduces the size of the vCard file.
Yes, this was my first thought.
Thank you very much for digging into this and providing this enhancement!
from ez-vcard.
No problem. Thanks for bringing the issue to my attention!
from ez-vcard.
Related Issues (20)
- Unable to share Vcf contact card for Android 11 and above. HOT 1
- IMPP: case-insensitive comparison of schemes HOT 1
- VCardWriter - Writes data without proper formatting for Google Contacts - Expected : YYYY-MM-DD ; current : YYYYMMDD HOT 2
- [Q] How do I get the `RawProperty`s? HOT 1
- Version 0.11.3 vulnerabilities HOT 3
- Migration to 0.12.0 while still supporting Android API 21..25 HOT 6
- Add support for Jigsaw modules HOT 1
- Parsing from chunk of text HOT 2
- Custom getter in VCardProperty HOT 9
- Invalid value for "MonthOfYear" caused by wrong BDAY date HOT 1
- Raw property values HOT 4
- Relations and Anniversaries are lost in serialization HOT 2
- what is the way to add social media contact? HOT 1
- Default line folding line length is not null HOT 1
- [Compatibility] Treat KIND values case-insensitive HOT 2
- whole vCard being drop instead of the specific corrupted fields HOT 3
- WhatsApp format of vcard is not supported?
- No Class found in DavX5 HOT 1
- hCard GEO HOT 1
- CRLF is handled incorrectly in vcard 2.1 properties HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ez-vcard.