marwensaid / eid-applet

Automatically exported from code.google.com/p/eid-applet
Other
1 stars 1 forks source link

Applet Service: UTF-8 vs jvm character set #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. running the Applet Service with jvm parameter -Dfile.encoding=ISO-8859-1
2. call AppletServiceServlet with an eid card containing special 
characters in the name, firstname or adress (é,è,à... any character 
encoded on 2 bytes in UTF-8)
3. print the identity in the session

What is the expected output? What do you see instead?
special characters are replaced by 2 characters

What version of the product are you using? On what operating system?
1.0.0-rc2 on Windows XP and AIX 5.3 and Red Hat Enterprise Linux Server 
release 5.1 (Tikanga)

Please provide any additional information below.
Identity Data sent by the applet is encoded in UTF-8. When the applet 
service converts these bytes into a String, it does it by default with the 
character set specified with -Dfile.encoding.
We cannot set our file.encoding to UTF-8. This would solve the issue but 
would have side effects on the other services deployed on our Application 
server.

Solution proposal:
convert bytes from the applet into a String with UTF-8 explicitely 
specified. 
I didn't test, but I think just modifying TlvParser.java line 118 should 
do the trick:
117             } else if (String.class == tlvType) {
118                 fieldValue = new String(tlvValue);

into

117             } else if (String.class == tlvType) {
118                 fieldValue = new String
(tlvValue, "UTF-8");

Kind Regards,

Frédéric

Original issue reported on code.google.com by frederic...@gmail.com on 29 Mar 2010 at 9:44

GoogleCodeExporter commented 9 years ago
Sorry, just saw issue 38 exactly same issue/solution.
Please discard this entry as soon as issue 38 is solved.

Original comment by frederic...@gmail.com on 30 Mar 2010 at 10:07

GoogleCodeExporter commented 9 years ago

Original comment by frank.co...@gmail.com on 19 Apr 2010 at 12:37