Coder Social home page Coder Social logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
Hello,

Thanks for your input.  I'm not sure if this is a bug though.  It makes sense 
that you could get a UTF-8 string after decoding a quoted-printable string.  
The purpose of quoted-printable is to encode characters which cannot be encoded 
in the current character set.

Original comment by mike.angstadt on 4 Dec 2013 at 3:20

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
Hi, 

thanks for the reply. 
But if I set the charset on the type to iso 8859-1 then I would expect the 
resulting string after decoding to be of charset iso 8859-1 and not utf-8.

Original comment by [email protected] on 4 Dec 2013 at 3:46

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
What is the exact string you are using in the CHARSET parameter value?  It 
looks like there must be a hyphen between "ISO" and "8859-1", instead of a 
space.  If there is a space, Java will not recognize the charset, which causes 
ez-vcard to decode it using UTF-8.

Original comment by mike.angstadt on 4 Dec 2013 at 4:07

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
"ISO-8859-1"

Original comment by [email protected] on 4 Dec 2013 at 4:24

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
Can you check to see if there are any parser warnings?  ez-vcard will add a 
parser warning if there is problem decoding a quoted-printable value.

To do that with the VCardReader class, call the getWarnings() method.  To do 
that with the Ezvcard class, pass an empty list into the "warnings()" method, 
then print the list after parsing the vCard.

Original comment by mike.angstadt on 4 Dec 2013 at 4:30

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
No warnings concerning quoted-printable.
Here's what I do:

  Note noteType = new Note(person.getComment());
  noteType.getParameters().setCharset(charset);
  vcard.addNote(noteType);
  ...
  StringWriter writer = new StringWriter();
  VCardWriter vCardWriter = new VCardWriter(writer, VCardVersion.V2_1, null, "\r\n");
  log.debug(vcard.validate(VCardVersion.V2_1));
  Ezvcard.write(vcard).version(VCardVersion.V2_1).go(writer);

Note contains:
"test
äöüß
test"

Result is:
NOTE;CHARSET=ISO-8859-1;ENCODING=quoted-printable:test=0A=C3=A4=C3=B6=C3=BC=
 =C3=9F=0Atest

Decoded:
testäöü �test

:(

Original comment by [email protected] on 9 Dec 2013 at 5:24

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
Ah, I see.  Ok, fixed it.  Thanks :D 

Original comment by mike.angstadt on 12 Dec 2013 at 3:49

  • Changed state: Fixed

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
I thought about this some more.  My first solution didn't solve the root of the 
problem, which is that the character encoding of the ***Writer*** object should 
be used by default when encoding a quoted-printable value.  You shouldn't need 
to manually set the CHARSET parameter.

The fix I've just committed will use the Writer object's character encoding if 
no CHARSET parameter is provided.  If it can't determine the Writer's character 
encoding, it will use your system's default character encoding.  If a CHARSET 
parameter is set, then it will use that character encoding instead of the 
Writer's.

Attached is the patched JAR.

Original comment by mike.angstadt on 13 Dec 2013 at 5:29

Attachments:

from ez-vcard.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 23, 2024
Hi,

great, thanks!

Original comment by [email protected] on 16 Dec 2013 at 9:06

from ez-vcard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.