unable to parse QUOTED PRINTABLE encoding in vcard

286 views
Skip to first unread message

java.co...@gmail.com

unread,
Feb 7, 2013, 5:23:24 AM2/7/13
to ez-vcard...@googlegroups.com
Hi ,

I am unable to parse the vcard having encoding QUOTED PRINTABLE.

I am using ez-vcard-0.7.1.jar and commons-codec-1.6.jar

The vcard that i am trying to parse is :

BEGIN:VCARD
VERSION:2.1
N;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=91=C3=91=C3=91=C3=91;;;;
FN;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=91=C3=91=C3=91=C3=91
TEL;CELL;PREF:55556666
EMAIL;PREF:he...@company.com
ORG;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=

ORG;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=80
ORG;CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=
=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=

CATEGORIES:My Contacts
END:VCARD



Code :I am sending this vcard as vcf file through browser and then parsing

VCard vcard = Ezvcard.parse(vcardFile).first();
//VERSION
String version = vcard.getVersion().getVersion();
bean.setVersion(version);
System.out.println("VERSION ->"+version);

//PRODID
String productId = null;
if(vcard.getProdId() != null){
ProdIdType prodIdType = vcard.getProdId();
productId = prodIdType.getValue();
bean.setProductId(productId);
}
System.out.println("PRODID ->"+productId);

//N
System.out.println("NAME ->");
String name = null;
if(vcard.getStructuredNames() != null){
List<StructuredNameType> structuredNamesList = vcard.getStructuredNames();
Iterator<StructuredNameType> itr = structuredNamesList.iterator();
while(itr.hasNext()){
StructuredNameType f = itr.next();
String givenName = f.getGiven();
String familyName = f.getFamily();
Iterator<String> it = null;
List<String> prefixList = f.getPrefixes();
it = prefixList.iterator();
String prefix = null;
while(it.hasNext()){
prefix = it.next();
break;
}
List<String> suffixList = f.getPrefixes();
it = suffixList.iterator();
String suffix = null;
while(it.hasNext()){
suffix = it.next();
break;
}
name = prefix+" "+givenName+" "+familyName+" "+suffix;
List<String> additionalList = f.getAdditional();
it = additionalList.iterator();
String additionalName = null;
while(it.hasNext()){
additionalName = it.next();
break;
}
System.out.println("GivenName -"+givenName+"|FamilyName -"+familyName+"|Prefix -"+prefix+"|Suffix -"+suffix+"|AdditionalName :"+additionalName);
bean.setName(name.trim());
//break;
}
}



Server logs
15:51:57,930 INFO [STDOUT] VERSION ->
15:51:57,930 INFO [STDOUT] 2.1
15:51:57,930 INFO [STDOUT] PRODID ->
15:51:57,930 INFO [STDOUT] NAME ->
15:51:57,946 INFO [STDOUT] GivenName -null|FamilyName -ÑÑÑÑ|Prefix -null|Suffix -null|AdditionalName :null
15:51:57,946 INFO [STDOUT] FN ->
15:51:57,946 INFO [STDOUT] NICKNAME ->
15:51:57,946 INFO [STDOUT] ORG ->
15:51:57,946 INFO [STDOUT] =C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91ORG
15:51:57,946 INFO [STDOUT] CHARSET=UTF-8
15:51:57,946 INFO [STDOUT] ENCODING=QUOTED-PRINTABLE:=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=C3=91=80
15:51:57,946 INFO [STDOUT] ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑCATEGORIES:My Contacts
15:51:57,946 INFO [STDOUT] TITLE ->
15:51:57,946 INFO [STDOUT] EMAIL ->
15:51:57,946 INFO [STDOUT] Email -he...@company.com| Group -null| Type -
15:51:57,946 INFO [STDOUT] TYPE|pref$
15:51:57,946 INFO [STDOUT] TEL ->
15:51:57,946 INFO [STDOUT] ContactNo -55556666| Group -null| Type -
15:51:57,946 INFO [STDOUT] TYPE|cell$
15:51:57,946 INFO [STDOUT] TYPE|pref$
15:51:57,946 INFO [STDOUT] ADR ->
15:51:57,946 INFO [STDOUT] URL ->
15:51:57,946 INFO [STDOUT] DOB ->
15:51:57,946 INFO [STDOUT] PHOTO ->






Michael Angstadt

unread,
Feb 7, 2013, 8:39:05 PM2/7/13
to ez-vcard...@googlegroups.com
Thanks for the bug report.  The problem was that it was ignoring the empty lines in the ORG property values and basically merging the first two ORG properties together.  Fixed in r391.

Michael Angstadt

unread,
Feb 15, 2013, 7:40:01 AM2/15/13
to ez-vcard...@googlegroups.com
Do you have a name so I can list you in the project credits? ;)

kiran bhushan

unread,
Apr 9, 2013, 3:33:03 AM4/9/13
to ez-vcard...@googlegroups.com
 
   kiran kumar bhushan

On Fri, Feb 15, 2013 at 6:10 PM, Michael Angstadt <mike.a...@gmail.com> wrote:
Do you have a name so I can list you in the project credits? ;)

--
You received this message because you are subscribed to the Google Groups "ez-vcard-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ez-vcard-discu...@googlegroups.com.
To post to this group, send email to ez-vcard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/ez-vcard-discuss/-/tKLHCCEjalcJ.

Reply all
Reply to author
Forward
0 new messages