#130 Charset cannot be specified

Pre-release (0.9)
Parsing (53)
Dan Jackels

I'm not sure if I'm overseeing something obvious, but my vcards are parsed with broken umlauts and I don't seem to be able to specify a charset.

For example utf-8 characters like ä or € are broken after they're read from the file.
It might be because I use a mac and Java doesn't necessarily use unicode on mac.

I used the following patch to solve the problem:
diff --git a/src/main/java/net/fortuna/ical4j/vcard/VCardBuilder.java b/src/main/java/net/fortuna/ical4j/vcard/VCardBuilder.java
index fcafe1a..3ec2577 100644
--- a/src/main/java/net/fortuna/ical4j/vcard/VCardBuilder.java
+++ b/src/main/java/net/fortuna/ical4j/vcard/VCardBuilder.java
@@ -37,6 +37,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URISyntaxException;
+import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
@@ -97,8 +98,8 @@ public final class VCardBuilder {
* @param in an input stream providing vCard data
- public VCardBuilder(InputStream in) {
- this(new InputStreamReader(in));
+ public VCardBuilder(InputStream in, Charset charset) {
+ this(new InputStreamReader(in, charset));



  • Dan Jackels

    Dan Jackels - 2011-06-03

    Example file

  • Ben Fortuna

    Ben Fortuna - 2011-06-03
    • status: open --> closed-fixed
  • Ben Fortuna

    Ben Fortuna - 2011-06-03

    Hi Dan,

    I have updated VCardBuilder to always use UTF-8 as the default charset. You can also specify an alternative charset as follows:

    VCardBuilder builder = new VCardBuilder(new InputStreamReader(myInputStream, Charset.forName(myCharsetName));



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks