File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Issue with characrter encoding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Issue with characrter encoding " Watch "Issue with characrter encoding " New topic

Issue with characrter encoding

sreeni san
Ranch Hand

Joined: Aug 14, 2001
Posts: 39
I have flex as my front end which sends the encoded values in the hex format.

For example if I enter k�t in the name field, the UTF-8 for "�" in hex is "c3a1" the flex client posts the data as "name=k%C3%A1t" (I got this info from the Live HTTP headers in my MF browser and verified for the hex values in few sites).

The "name" value is then stored in a table in the MySQL database.

When I query the database using the following query
"select hex(name ), name from customer where id=100;", the query returns me the following value for name.

hex(name) | name |
6BC383C2A174 | k�t |

You can see that though the correct value is "6BC3A174", "83C2" is getting appended in the value corrupting the data before it reaches the buslogic code.

I tried giving System.out.println(name) but this did not help me. I hard coded the value(k�t) for name in my java code and inserted the same, the value seems to be getting stored properly and hence arrived at the above conclusion.

Note: The customer table i am referring to has Character Set "UTF-8 Unicode" and Collation "utf8_general_ci".
I agree. Here's the link:
subject: Issue with characrter encoding
It's not a secret anymore!