File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing MultiLingual characters from a jsp

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic