Comments (9)
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.
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.
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.
"ISO-8859-1"
Original comment by [email protected]
on 4 Dec 2013 at 4:24
from ez-vcard.
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.
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.
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.
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.
Hi,
great, thanks!
Original comment by [email protected]
on 16 Dec 2013 at 9:06
from ez-vcard.
Related Issues (20)
- 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
- Wrong value for vCard property VERSION returned HOT 4
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.