This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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,