mangstadt / ez-vcard Goto Github PK
View Code? Open in Web Editor NEWA vCard parser library for Java
License: Other
A vCard parser library for Java
License: Other
I am doing a unit test to check if my address field are filled I am using the following vCard:
BEGIN:vCard
VERSION:3.0
FN:Frank Dawson
ORG:Lotus Development Corporation
ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive
;Raleigh;NC;27613-3502;U.S.A.
TEL;TYPE=VOICE,MSG,WORK:+1-919-676-9515
TEL;TYPE=FAX,WORK:+1-919-676-9564
EMAIL;TYPE=INTERNET,PREF:[email protected]
EMAIL;TYPE=INTERNET:[email protected]
URL:http://home.earthlink.net/~fdawson
END:vCard
Unfortunately, checking my type parameters, I receive "WORK" instead of "WORK". Changing "TYPE=WORK,POSTAL" to "TYPE=WORK;POSTAL" I got the right parameter.
my ref: https://en.wikipedia.org/wiki/VCard#vCard_2.1 / https://tools.ietf.org/html/rfc6350 / http://www.evenx.com/vcard-3-0-format-specification
What steps will reproduce the problem?
1. InputStream is = new FileInputStream("test/resources/Herr Steve Jobs.vcf");
2. Ezvcard.parse(is).all();
3. vCards.get(0).getAddresses().get(0).getStreetAddress();
What is the expected output?
ß
What is the actual output?
�
What version of ez-vcard are you using?
0.9.6
What version of Java are you using?
8
Please provide any additional information below.
Reading the InputStream with an InputStreamReader uses the system default
charset to determine nextChar(). This prevents the proper decoding with the
provided encoding parameter.
nextchar() already returns
U+FFFD � ef bf bd REPLACEMENT CHARACTER
when it encounters the DF byte in the file and trying to decode it afterwards
with Windows-1252 does not restore U+00DF. The information is destroyed.
Each block should be read with a bytestream and the the string should be
created with the encoding provided in the encoding parameter of the line.
Original issue reported on code.google.com by [email protected]
on 18 Nov 2014 at 5:03
Attachments:
What steps will reproduce the problem?
1. Set a Note-value to something with newlines and special chars
2. Write vCard with VCardVersion.V2_1
What is the expected output?
The complete result is in ISO 8859-1 including the quoted-printable parts after
they are decoded
What is the actual output?
The result is in ISO 8859-1 except for the quoted-printable parts which after
decoding turn out to be in UTF-8
What version of ez-vcard are you using?
0.9.0
What version of Java are you using?
1.6
Please provide any additional information below.
This also happens if I explicitly set the charset of the properties to ISO
8859-1
Original issue reported on code.google.com by [email protected]
on 27 Nov 2013 at 3:03
Hi,
I would like to change the specific encoding of a field:
NOTE;CHARSET=iso-8859-1: üèäà:
in the addNote() method I don't find any specific parameter.
thanks
G
What steps will reproduce the problem?
1. Call method AdressType.getTimezome() when no timezone set.
What is the expected output?
null value, no exception.
What do you see instead?
NullPointerException.
What version of the product are you using? On what operating system?
ez-vcard 0.7.2, java 1.6, Windows 7
---------------
Stack trace :
Caused by: java.lang.NullPointerException
at ezvcard.types.AddressType.getTimezone(AddressType.java:381)
---------------
AdressType.java :
public String getTimezone() {
String value = subTypes.getFirst("TZ");
if (value.matches("(?i)tz:.*")) { <====== NullPointerException
//remove the "tz:"
value = (value.length() > 3) ? value.substring(3) : "";
}
return value;
}
---------------
VCardSubTypes.java :
public String getFirst(String name) {
List<String> list = get(name);
return list.isEmpty() ? null : list.get(0);
}
Original issue reported on code.google.com by [email protected]
on 10 Apr 2013 at 2:28
What steps will reproduce the problem?
1. Create new empty test project, import ez-vcard/0.9.1
2. Use this code:
public static void main(String[] args) {
System.out.println(Ezvcard.VERSION);
}
What is the expected output?
"0.9.1"
What is the actual output?
"${version}"
What version of ez-vcard are you using?
0.9.1
What version of Java are you using?
* OpenJDK 1.7.0
* Android 4.0+ (Java 6)
Please provide any additional information below.
PRODID generated by Ezvcard also contains the "${version}" value.
Original issue reported on code.google.com by [email protected]
on 25 Jan 2014 at 12:04
What steps will reproduce the problem?
VCard vcard = new VCard();
StructuredName name = new StructuredName();
name.setGiven("John");
name.setFamily("Smith");
vcard.setStructuredName(name);
vcard.setGender(Gender.male());
Address address = new Address();
address.addType(AddressType.HOME);
address.setLocality("City");
address.setStreetAddress("1234 Somestreet");
vcard.addAddress(address);
String html = Ezvcard.writeHtml(vcard).go();
System.out.println(html);
What is the expected output?
...
<span class="street-address">1234 Somestreet</span><br />
...
What is the actual output?
...
<span class="street-address"></span><br />
...
What version of ez-vcard are you using?
0.9.5
What version of Java are you using?
1.7.0
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Sep 2014 at 11:25
ezvcard.util.XMLUtils
private static Document toDocument(InputSource in) throws SAXException, IOException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setIgnoringComments(true);
DocumentBuilder builder;
try {
builder = factory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
//should never be thrown because we're not doing anything fancy with the configuration
throw new RuntimeException(e);
}
return builder.parse(in);
}
Has an XXE vulnerability - Please dsiable External xml entity processing:
References:
https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Prevention_Cheat_Sheet
https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Processing
Java class ezvcard.Ezvcard
currently parses file ez-vcard.properties to initialize constant values (VERSION
, GROUP_ID
, ARTIFACT_ID
and URL
).
However, we could easily get these values from file MANIFEST.MF . Example to retreive project version:
VERSION = Ezvcard.class.getPackage().getImplementationVersion();
Have you already studied this solution?
References:
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:
VERSION:3.0
X-ADDRESSBOOKSERVER-KIND:group
FN:My Group
N:My 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 of N: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 ;
:
N:Public;John;Quinlan;Mr.;Esq.
instead of
N:Public;John;Quinlan;Mr.;Esq.;
This should be applicable to other structured fields too and could reduce the complexity (and size) of generated VCards.
VCard 2.1 specification section 2 (Delimiters) says:
""""
A formatted text line break in a property value, must also be represented by a
(RFC 822) line break, which is a CRLF sequence. However, since the CRLF
sequence is used to delimit a line, property values with formatted line breaks
(i.e., multiple lines) must be encoded using an alternate encoding of either
Quoted-Printable or Base64, as defined in RFC 1521.
""""
To reproduce the problem:
VCard vcard = new VCard();
vcard.addNote(new NoteType("Line one\r\nLine two"));
StringWriter writer = new StringWriter();
new VCardWriter(writer, VCardVersion.V2_1).write(vcard);
System.out.println(writer);
Actual output is:
BEGIN:VCARD
VERSION:2.1
NOTE:Line one\nLine two
X-PRODID:ez-vcard 0.6.0
END:VCARD
Expected output is:
BEGIN:VCARD
VERSION:2.1
NOTE;ENCODING=QUOTED-PRINTABLE:Line one=0D=0ALine two
X-PRODID:ez-vcard 0.6.0
END:VCARD
Original issue reported on code.google.com by [email protected]
on 2 Jan 2013 at 8:48
Currently, the template html file for hCard writing ( hcard-template.html ) is
hard coded in HCardPage. Allowing the user to specify a custom template would
permit much greater flexibility. For example, I currently have a project where
the hCard data needs to be displayed as part of an existing html page rather
than as a standalone page. Currently, the is no way to accomplish this without
manually stripping off unwanted html tags.
Original issue reported on code.google.com by [email protected]
on 6 Mar 2015 at 8:00
Hi all,
I would like to add a custom type to a telephone number:
final Telephone telCAP = new Telephone("123456789");
telCAP.getParameters().setCharset("ISO-8859-1");
telCAP.getParameters().addType("SPÉCciälö"));//
vcard.addTelephoneNumber(telCAP);
but the accents are not encoded, can someone please help me?
Regards
G.
This is a feature request.
I’d like to be able to create a string showing the content of a vcard as
key-value pairs.
The closest I get is as follows. I get an iterator with vCard.iterator() then
for each VCardType I can ask the type name (using getTypeName()), and the
class. Then, with a switch depending on the class, I can get the value, using
the appropriate method combinations depending on the type.
It would be nice if this use case was better supported, e.g. with a general
method "getStringValue" on the VCardType class which would give the string
content of the value associated to the type. What I’m doing now instead feels
a bit stupid, as I’m basically doing work to retrieve stuff which is known by
the internal parser already.
I’m sorry I don’t use the wording from the specs (which I don’t know), I
hope my issue is understandable.
If the feature actually exists, please consider this issue as a request for
indicating it in the documentation (unless I have missed it!). I haven’t been
able to find this on this site.
Original issue reported on code.google.com by olivier.cailloux
on 7 Sep 2013 at 9:27
When running this test code:
public void testEzvcardPref() throws IOException {
//Impp property = new Impp("xmpp", "[email protected]");
Email property = new Email("[email protected]");
property.setPref(1);
VCard vCard = new VCard();
//vCard.addImpp(property);
vCard.addEmail(property);
StringWriter writer = new StringWriter();
new VCardWriter(writer, VCardVersion.V3_0).write(vCard);
new VCardWriter(writer, VCardVersion.V4_0).write(vCard);
Constants.log.info(writer.toString());
}
The (expected) test output is:
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: VERSION:3.0
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: EMAIL;TYPE=pref:[email protected]
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: VERSION:4.0
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: EMAIL;PREF=1:[email protected]
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:27:16.550 24086-24099/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
As you can see, VCard 3 uses TYPE=pref
and for VCard 4, PREF=1
is generated (as expected).
When changing the property to IMPP instead of email (just use the commented lines in the source code above), the output changes to:
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: VERSION:3.0
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: IMPP;PREF=1:xmpp:[email protected]
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: BEGIN:VCARD
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: VERSION:4.0
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: IMPP;PREF=1:xmpp:[email protected]
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: PRODID:ez-vcard 0.9.7
10-14 12:28:35.965 25296-25309/at.bitfire.vcard4android.test I/vcard4android: END:VCARD
Here, PREF=1
is used for VCard 3, too.
I don't know whether this is because VCard 3 doesn't define IMPP, but RFC 4770 VCard 3 IMPP Extension uses TYPE=pref, too.
What steps will reproduce the problem?
1. double click on ez-vcard-0.9.6
2. "The Java JAR file could not be launched"
3.
What is the expected output?
it runs
What is the actual output?
it doesn run
What version of ez-vcard are you using?
0.9.6
What version of Java are you using?
newest version for mac os
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 28 Feb 2015 at 12:12
Hi,
I'm not able to update productId value.
What steps will reproduce the problem?
What is the expected output?
PRODID:test
What is the actual output?
PRODID:ez-vcard 0.9.9
What version of ez-vcard are you using?
0.9.9
What version of Java are you using?
6
Please provide any additional information below.
If I get only productId, I get back the right value :
System.out.println("product id : "+vcard.getProductId().getValue());
=> product id : test
What steps will reproduce the problem?
1.Run unit tests
2.
3.
What is the expected output?
No failures
What is the actual output?
2 failures
What version of ez-vcard are you using?
0.9.6
What version of Java are you using?
1.7
Please provide any additional information below.
1. ezvcard.io.html.create_then_parse()
2. ezvcard.io.xml.XCardWriterTest.write_prettyPrint()
Original issue reported on code.google.com by [email protected]
on 5 Nov 2014 at 10:19
What steps will reproduce the problem?
1.Create a prodidtype and set it to vcard
What is the expected output?
the string "xxxxxxx"
What is the actual output?
ez-vcard 0.8.3
What version of ez-vcard are you using?
ez-vcard 0.8.3
What version of Java are you using?
1.6
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 17 Sep 2014 at 5:23
STEPS TO REPRODUCE:
1. Have ez-vcard-0.8.0.jar in the classpath, but not freemarker
2. call new VCardReader("").readNext();
EXPECTED OUTPUT:
readNext() should return a null reference
ACTUAL OUTPUT:
[junit] java.lang.NoClassDefFoundError: freemarker/template/TemplateException
[junit] at java.lang.Class.getDeclaredMethods0(Native Method)
[junit] at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
[junit] at java.lang.Class.getMethod0(Class.java:2685)
[junit] at java.lang.Class.getMethod(Class.java:1620)
[junit] at ezvcard.types.TypeList.<clinit>(TypeList.java:149)
[junit] at ezvcard.io.VCardReader.createTypeObject(VCardReader.java:430)
[junit] at ezvcard.io.VCardReader.readNext(VCardReader.java:349)
ez-vcard version 0.8.0
java version "1.7.0_10"
Java(TM) SE Runtime Environment (build 1.7.0_10-b18)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
Original issue reported on code.google.com by [email protected]
on 15 May 2013 at 8:33
What steps will reproduce the problem?
1. String test = null;
2. String result = VCardStringUtils.unescape(test);
What version of ez-vcard are you using?
0.8.0
What version of Java are you using?
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
Please provide any additional information below.
As a suggestion, I've attached a patch that checks for null input and just
returns it unchanged to the user.
Original issue reported on code.google.com by [email protected]
on 12 May 2013 at 8:44
Attachments:
What steps will reproduce the problem?
ParserChainTextReader reader = Ezvcard.parse(new File(fileName
+ ".vcf"));
List<VCard> cards = reader.all();
Iterator<VCard> iter = cards.iterator();
Ezvcard.writeHtml(cards).go(new File(fileName + "new.html"));
NOTE: No Error when converting to XML, JSON.
What is the expected output?
HTML file all the data
What is the actual output?
Partial HTML
What version of ez-vcard are you using?
latest, just downloaded
What version of Java are you using?
1.6 and 1.7
Please provide any additional information below.
Apr 22, 2014 2:50:43 PM freemarker.log._JDK14LoggerFactory$JDK14Logger error
SEVERE: Error executing FreeMarker template
FreeMarker template error:
The following has evaluated to null or missing:
==> org [in template "hcard-template.html" at line 407, column 107]
Tip: If the failing expression is known to be legally null/missing, either
specify a default value with myOptionalVar!myDefault, or use <#if
myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the
last step of the expression; to cover the whole expression, use parenthessis:
(myOptionVar.foo)!myDefault, (myOptionVar.foo)??
The failing instruction (FTL stack trace):
----------
==> ${org} [in template "hcard-template.html" at line 407, column 105]
#if org_index == 0 [in template "hcard-template.html" at line 406, column 65]
----------
Java stack trace (for programmers):
----------
freemarker.core.InvalidReferenceException: [... Exception message was already
printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.IfBlock.accept(IfBlock.java:84)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:86)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Environment.process(Environment.java:243)
at freemarker.template.Template.process(Template.java:277)
at ezvcard.io.html.HCardPage.write(HCardPage.java:158)
at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1691)
at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1675)
at MyVCard.main(MyVCard.java:25)
Exception in thread "main" java.lang.RuntimeException:
freemarker.core.InvalidReferenceException: The following has evaluated to null
or missing:
==> org [in template "hcard-template.html" at line 407, column 107]
Tip: If the failing expression is known to be legally null/missing, either
specify a default value with myOptionalVar!myDefault, or use <#if
myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the
last step of the expression; to cover the whole expression, use parenthessis:
(myOptionVar.foo)!myDefault, (myOptionVar.foo)??
The failing instruction (print stack trace for 1 more):
==> ${org} [in template "hcard-template.html" at line 407, column 105]
at ezvcard.io.html.HCardPage.write(HCardPage.java:161)
at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1691)
at ezvcard.Ezvcard$WriterChainHtml.go(Ezvcard.java:1675)
at MyVCard.main(MyVCard.java:25)
Caused by: freemarker.core.InvalidReferenceException: The following has
evaluated to null or missing:
==> org [in template "hcard-template.html" at line 407, column 107]
Tip: If the failing expression is known to be legally null/missing, either
specify a default value with myOptionalVar!myDefault, or use <#if
myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the
last step of the expression; to cover the whole expression, use parenthessis:
(myOptionVar.foo)!myDefault, (myOptionVar.foo)??
The failing instruction (print stack trace for 1 more):
==> ${org} [in template "hcard-template.html" at line 407, column 105]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.IfBlock.accept(IfBlock.java:84)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:86)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visitByHiddingParent(Environment.java:286)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:193)
at freemarker.core.Environment.visitIteratorBlock(Environment.java:509)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:103)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.MixedContent.accept(MixedContent.java:93)
at freemarker.core.Environment.visit(Environment.java:265)
at freemarker.core.Environment.process(Environment.java:243)
at freemarker.template.Template.process(Template.java:277)
at ezvcard.io.html.HCardPage.write(HCardPage.java:158)
... 3 more
Original issue reported on code.google.com by [email protected]
on 22 Apr 2014 at 9:25
@blendmaster writes in pull request 37:
Another suggestion I have is to add copy constructors or methods to all the properties, a la fullcontact#2 . I currently use https://github.com/EsotericSoftware/kryo to make deep copies , but it'd be nice to have something native.
I have updated the ez-vcard dependency in vcard4android from 0.9.6 to 0.9.7, which causes the generated PHOTO
property to be broken, because there's an empty line after the end of the property (note the double [CR][LF] at the end):
BEGIN:VCARD[CR][LF]
VERSION:3.0[CR][LF]
UID:0bpdjwux-fy4i-y5pb-h6xd-k7rphj54jjen[CR][LF]
PRODID:+//IDN bitfire.at//DAVdroid/0.9vcard4android ez-vcard/0.9.7[CR][LF]
…
PHOTO;ENCODING=b;TYPE=jpeg:/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJ[CR][LF]
CQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2w[CR][LF]
BDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy[CR][LF]
MjIyMjIyMjIyMjL/wAARCALQAtADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAw[CR][LF]
QFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0Kx[CR][LF]
wRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3[CR][LF]
…
C7Mq9FJOB9B2p1shLkm3Z1PQqpNSarc29lcoIJJSW6llwPwrPeZoowYwUXrw5rn21Odx3R//2Q[CR][LF]
==[CR][LF]
[CR][LF]
REV:20151018T212428Z[CR][LF]
END:VCARD[CR][LF]
I'm quite sure that's because of some changes from 0.9.6 to 0.9.7 (because when setting the dependency back to 0.9.6, everything works again), but if you like, I can write a test.
This problem occurs when adding pretty long String to the Notefild and
importing the vcard into Outlook (I´m using Outlook 2010)
To reproduce the problem:
VCard vcard = new VCard();
vcard.addNote(new NoteType("twitter: www.twitter.com/NameName\nlinkedIn: www.linkedin.com/inNameName\nxing: www.xing.com"));
StringWriter writer = new StringWriter();
new VCardWriter(writer, VCardVersion.V2_1).write(vcard);
System.out.println(writer);
Expected Output
When opening the *.vcf file in Outlook, I expect
twitter:
www.twitter.com/NameName
LinkedIn:
www.linkedin.com/in/NameName
xing:
www.xing.com/profile/NameName
Actual Output:
But what I actual got is:
twitter:
www.twitter.com/NameName
Linked
And that is it. Because within the *.vcf file is a line break after a specific
number of characters, and everything in the new line isn´t showing in
Outlook´s Notefield.
This is really bugging me, because I have pretty long links to put into the
notefield.
If I don´t use \n for example and write everything inline, there is always a
space when there is a break in the *.vcf file. And within a link this is a real
problem, because it should be clickable.
I attached a screenshot that hopefully makes this more clear.
EzVcard Version: 0.8.4
Java Version: 1.7
Thank you!
Original issue reported on code.google.com by [email protected]
on 24 Sep 2013 at 10:16
Attachments:
What steps will reproduce the problem?
1.Get the type of the address and phone numbers
2.
3.
What is the expected output?
Return the type of phone eg work or home
What is the actual output?
null
What version of ez-vcard are you using?
version 4
What version of Java are you using?
jdk 1.7
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 27 Jun 2014 at 7:36
Hi,
Let's take a look to the following example:
public static void main(String[] args) throws IOException {
VCard vCard = new VCard();
vCard.setVersion(VCardVersion.V2_1);
vCard.addFormattedName(new FormattedName(
"thisIsAName aVeryLongName thisIsAName aVeryLongName thisIsAName aVeryLongName, thisIsAName aVeryLongName thisIsAName aVeryLongName"));
vCard.addTelephoneNumber("0123456789", TelephoneType.CELL);
vCard.write(System.out);
}
The output will be:
BEGIN:VCARD
VERSION:2.1
FN:thisIsAName aVeryLongName thisIsAName aVeryLongName thisIsAName aVeryLon
gName\, thisIsAName aVeryLongName thisIsAName aVeryLongName
TEL;CELL:0123456789
X-PRODID:ez-vcard 0.9.8
END:VCARD
I know that's a strange name, but is it normal that the comma is preceded by a backslash? And why is the FN split into several lines (breaking words in two) starting each line with a space?
Thanks in advance.
What steps will reproduce the problem?
1. Parse a vcard that contains an URL-encoded value that contains invalid
digits in the encoding (for instance %4x)
What is the actual output?
java.lang.RuntimeException:
ezvcard.util.org.apache.commons.codec.DecoderException: Invalid URL encoding:
not a valid digit (radix 16): 61
at ezvcard.io.text.VCardReader.decodeQuotedPrintable(VCardReader.java:329)
at ezvcard.io.text.VCardReader.access$400(VCardReader.java:87)
at
ezvcard.io.text.VCardReader$VCardDataStreamListenerImpl.readProperty(VCardReader
.java:410)
at ezvcard.io.text.VCardRawReader.parseLine(VCardRawReader.java:201)
at ezvcard.io.text.VCardRawReader.start(VCardRawReader.java:79)
at ezvcard.io.text.VCardReader.readNext(VCardReader.java:237)
at ezvcard.Ezvcard$ParserChainText.first(Ezvcard.java:677)
at ezvcard.Ezvcard$ParserChainTextReader.first(Ezvcard.java:729)
What is the expected output?
A VCardException (for instance, a CannotParseException) should be thrown
because library callers will handle VCardException, but not all kinds of
exceptions.
What version of ez-vcard are you using?
0.9.2
Please provide any additional information below.
Found while analysing a crash report of DAVdroid [http://davdroid.bitfire.at]
Original issue reported on code.google.com by [email protected]
on 15 Mar 2014 at 11:27
FreeMarker library is not supported on Android platform due to absence of java.beans
package in Android Core Libraries and hence ez-vcard throws an exception when I try to create a HCard on Android.
How to fix this?
More details on the FreeMarker Android issue are available in this StackOverflow.com thread. In this thread, there is also a link to some patch that was supposed to make FreeMarker work on Android but it didn't work out either. :(
When writing a vCard, if a property name or group has an "invalid" character in it, the entire write operation is aborted due to a thrown exception.
in the Windows 10 Contact Application everything that is marked with "ENCODING=quoted-printable" in lower case is misinterpreted. When it is changed to ENCODING=QUOTED-PRINTABLE in upper case it works fine.
I guess it is more a problem of the Win 10 Contact App.
While investigating an issue with importing a .vcf file that was exported from OS X, we found ASCII characters that are not supported by the default XML 1.0 version generated when creating a new XCardDocument. The issue is revealed later when a backend component attempts to parse the generated XML using SAX.
I was looking for a way via ez-vcard to allow setting the XML version to 1.1 when generating the XCardDocument.
@blendmaster writes in pull request 37:
It comes in handy for implementing contact syncing systems, which often have to ask the question "are these two vcards equal", or if they aren't, "which fields are not equal"?
Can you implement new class UrlType
which is similar to class EmailType
?
1. Try to read this vCard:
BEGIN:VCARD
VERSION:2.1
N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Р=9FРµС=80РµС=80РІР°;Р=9B�
�=8EР±РѕРІС=8C;Р=94РјРёС=82С=80иевна;;
FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:Р=9BС=8EР±РѕРІС=8C
Р=9FРµС=80РµС=80РІР°
TEL;PREF;CELL;VOICE:+380975492937
TEL;HOME:+380669313512
X-IRMC-LUID:1
END:VCARD
2. Read the name like this:
vcard.getFormattedName().getValue()
Expected output:
Should be Cyrillic string in UTF-8:
Перерва;Любовь;Дмитриевна;;
Actual result:
charset-unaware string: ?�?�????� ?�??�??�??
Please, fix this and make it possible to read vCard data in different charsets
Original issue reported on code.google.com by andronix83
on 4 Mar 2013 at 10:05
As many libraries already do, it would be great if ez-vcard would provide OSGi
metadata out-of-the-box, too, so that it can be easily used in an OSGi
environment.
Changes to the POM:
1. Replace:
<packaging>jar</packaging>
with
<packaging>bundle</packaging>
2. Add:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
</plugin>
...
</plugins>
</build>
3. Eyeball the generated Manifest file and tweak it if needed by configuring the maven-bundle-plugin
What is the expected output?
A Manifest with OSGi metadata
What is the actual output?
A Manifest without OSGi metadata
What version of ez-vcard are you using?
0.9.0
What version of Java are you using?
1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08
Please provide any additional information below.
Original issue reported on code.google.com by puce1977
on 29 Nov 2013 at 10:14
Hi,
I would like to add an extended property to the telephone number but is not working.
The result should be something like that:
TEL;X-Customer Service:+1123123123
Thanks
What steps will reproduce the problem?
1.
2.
3.
What is the expected output?
getEmail should return email
What is the actual output?
No such function
What version of ez-vcard are you using?
0.9.4
What version of Java are you using?
1.7 jdk
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 26 Jun 2014 at 6:20
VCARDs generated by ez-vcard 0.1.1 cannot be opened by some applications
(tested with Kontact 4.4.8).
When I change the first line, removing the whitespace, "BEGIN: vcard" to
"BEGIN:vcard", it works.
Snippit of the RFC2426 VCARD grammar:
########## BEGIN ############
vcard = [group "."] "BEGIN" ":" "VCARD" 1*CRLF
1*(contentline)
;A vCard object MUST include the VERSION, FN and N types.
[group "."] "END" ":" "VCARD" 1*CRLF
########### END #############
No space is allowed between ":" and "VCARD".
I'm not sure if lowercase "vcard" is allowed either.
Original issue reported on code.google.com by [email protected]
on 6 Aug 2012 at 8:47
When parsing the example from https://tools.ietf.org/html/rfc6350#section-6.2.3:
NOTE:This fax number is operational 0800 to 1715
EST\, Mon-Fri.
(two spaces in the second line)
ez-vcard/0.9.7 seems to return the value This fax number is operational 0800 to 1715EST, Mon-Fri.
(note the missing space before EST).
Is this intentional? As far as I have seen, the first " " means "continue from previous line", while the second " " should be taken into account for the property value (but I'm not an expert at that, I just noticed that parsing the example didn't return what I expect).
See also the examples in https://tools.ietf.org/html/rfc6350#section-3.2
I am trying to convert a V2.1 Vcard into V4.0 by reading it with your library and writing it to another file. But it seems, that setting 'versionStrict(true)' only removes unsupported properties and not parameters from the output.
For example, the "EMAIL" property has the parameters "INTERNET" and "PRIMARY" in my input file and in the output file they are still present.
Is this a bug, or is this behaviour intended?
The Birthday class has no method to set a language parameter. According to RFC 6350, it should be possible to assign one. (See https://tools.ietf.org/html/rfc6350#section-6.2.5)
Consider a CardDAV add-on.
Consider to use/ integrate with an existing Open Source CardDAV protocol
library instead of writing it from scratch.
This would allow to support all the specifications supported by ez-vcard also
with the CardDAV protocol.
It would also allow to share code when working with vCards _and_ CardDAV
instead of having 2 libraries working with vCards (CardDAV uses vCard for
contact data: http://en.wikipedia.org/wiki/CardDAV).
Original issue reported on code.google.com by puce1977
on 13 Feb 2015 at 11:21
It looks like GeoType cuts of the number after 4 digits after the decimal
separator when marshalling.
In examples I've seen elsewhere I see examples using 6 digits after the
separator.
- http://tools.ietf.org/html/rfc6350#section-6.5.2
- http://en.wikipedia.org/wiki/Geo_URI
Google Maps also uses a granularity of 6 digits when copying links to positions.
The number format should probably be "0.######" instead of "0.####" on line 264
of GeoType.java.
Original issue reported on code.google.com by [email protected]
on 15 Nov 2012 at 3:01
What steps will reproduce the problem?
1.Create vCard v2.1 with a BASE64-encoded public key
2.Open vCard in Outlook 2010
3.Outlook does not find the public key (under 'Certificates')
What version of ez-vcard are you using?
0.9.6
What version of Java are you using?
1.7
Please provide any additional information below.
I had to add a newline ('\r\n') after the BASE64-encoded public key. The '\r\n'
is also the BASE64 chunking delimeter, and the single '\r\n' at the end of the
key is not being read as the end of the 'KEY' value.
Original issue reported on code.google.com by [email protected]
on 5 Nov 2014 at 10:00
Attachments:
According to the VCard 4 specs, the GENDER value is used to identify sex and gender identity.
The components correspond, in sequence, to the sex
(biological), and gender identity. Each component is optional.
Sex component: A single letter. M stands for "male", F stands
for "female", O stands for "other", N stands for "none or not
applicable", U stands for "unknown".
Gender identity component: Free-form text.
GENDER-param = "VALUE=text" / any-param
GENDER-value = sex [";" text]
sex = "" / "M" / "F" / "O" / "N" / "U"
This makes sense, as M/F/O/N/U are values for sex. The gender identity is the free-form text.
However, in the API, getGender()
/setGender()
reads/writes the sex value and not the gender value, whereas getText()
/setText()
reads/writes the gender identity.
I suggest to rename getGender()
/setGender()
to setSex()
/getSex()
to make clear that the value is the biological sex. getText()
/setText()
is not for "extra explanatation", but the gender identity, which may even be given without a sex component. So maybe it should be renamed, too:
getGender()
/setGender()
→ getSex()
/setSex()
getText()
/setText()
→ getGenderIdentity()
/setGenderIdentity()
Gender and sex are also mixed in the documentation, for instance:
isMale() Determines if the gender is "male" or not.
Should be:
isMale() Determines if the sex is "male" or not.
Versions 3.0 and 4.0 state that all folded lines must begin with exactly one whitespace character. However, version 2.1 states that a folded line can begin with one or more whitespace characters.
ez-vcard currently only ignores the first whitespace character when parsing folded lines. Therefore, if a 2.1 vCard prepends folded lines with multiple whitespace characters, ez-vcard will treat the extra whitespace characters as part of the value. This wrong.
Therefore, when parsing a 2.1 vCard, ez-vcard should ignore ALL whitespace characters at the beginning of each folded line (not just the first whitespace character, as is currently done).
In addition, when writing a 2.1 vCard, ez-vcard should take care to fold long lines in such a way so that none of the folded lines begin with whitespace characters that are part of the property value.
Note: Fixing this issue will probably mean that the code in the BinaryPropertyScribe that removes whitespace characters from base64 values can be removed. This code was added because one of the sample vCards used in unit testing is a 2.1 vCard that uses multiple whitespace characters for folding (I didn't know at the time that 2.1 allows multiple whitespace characters).
What steps will reproduce the problem?
1. Create new empty test project, import ez-vcard/0.9.1
2. Use this code:
public static void main(String[] args) {
// taken from example in Javadocs for Organization
VCard vcard = new VCard();
Organization org = new Organization();
org.addValue("Google");
org.addValue("GMail Team");
org.addValue("Spam Detection Team");
vcard.setOrganization(org);
System.out.println(Ezvcard.write(vcard).version(VCardVersion.V3_0).go());
}
What is the expected output?
BEGIN:VCARD
VERSION:3.0
ORG:Google;GMail Team;Spam Detection Team
PRODID:ezvcard 0.9.1
END:VCARD
What is the actual output?
BEGIN:VCARD
VERSION:3.0
ORG:Google,GMail Team,Spam Detection Team
PRODID:ezvcard ${version}
END:VCARD
What version of ez-vcard are you using?
0.9.1
What version of Java are you using?
* OpenJDK 1.7.0
* Android 4.0+ (Java 6)
Original issue reported on code.google.com by [email protected]
on 25 Jan 2014 at 12:02
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.
What steps will reproduce the problem?
1. Parse this String via Ezvcard.parse().first()
BEGIN:VCARD
FN;quoted-printable:Max Ma=DF
TEL;voice:+49123123
END:VCARD
2. Access FormattedName via VCard-Api
vCard.getFormattedName().getValue()
What is the expected output?
Max Maß
What is the actual output?
Max Ma�
What version of ez-vcard are you using?
0.9.1
What version of Java are you using?
1.7.0_17
Original issue reported on code.google.com by [email protected]
on 7 Jan 2014 at 12:31
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.