This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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".
It is sorta covered in the JavaRanch Style Guide.
subject: Issue with characrter encoding
It's not a secret anymore!