Get your CodeRanch badge!*
The moose likes Servlets and the fly likes Passing MultiLingual characters from a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Passing MultiLingual characters from a jsp" Watch "Passing MultiLingual characters from a jsp" New topic
Author

Passing MultiLingual characters from a jsp

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I have set the charset to "utf-8" in my jsp to take characters of any language. When i pass these to a servlet and make a call to the database, the characters/string is not stored in its original form, but in its ASCII notation and the database goes for a toss in this situation.
Eg: If my database field is of length 10 and i want to enter multi-lingual characters, then each character will take 2 bytes instead of one, i.e. a string of length 5 only can be stored in such a field. But because in this case the ASCII notation is going to the database. The length of one character in ASCII notation is 8 bytes and hence it does not store for more than 1 character when it could have stored atleast 5.
I am entering '��' (a japanese character) in the jsp, it is being stored as 'か' in the database which is its ASCII notation and not as '��'. The actual length of this character '��' is just 2 bytes, though because the ASCII is going in the database ('か') whose length becomes 8 bytes.
Please tell me how to resolve this so that the value entered in the database is not its ASCII notation but its actual value.
Regards,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing MultiLingual characters from a jsp
 
Similar Threads
UrlyBird - question about the data file format
URLyBird data file format
Problem with DataInputStream & DataOutputStream
ASCII characters AND Java characters
Data File Format & Schema File