| Author |
About character encoding
|
Jack Lau
Ranch Hand
Joined: Aug 30, 2002
Posts: 166
|
|
Hello All, If I have a jsp file which has contentType="text/html;charset=UTF-8", and I would like to type some chinese words in the text box and submit to server and then save to db (varchar2). I try to use new String(mytext.getBytes(request.getCharacterEncoding()), "UTF-8"); or new String(mytext.getBytes(request.getCharacterEncoding()), "gb2312"); but the result still "???". Could anyone know how to solve it? Thanks in advance! Jack
|
 |
Nicholas Cheung
Ranch Hand
Joined: Nov 07, 2003
Posts: 4982
|
|
I guess you might not need to do the coversion for the Strings, but you might try using:
request.setCharacterEncoding("UTF-8");
to force the request using UTF-8 encoding. Nick
|
SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
|
 |
Ram Kumar Subramaniam
Ranch Hand
Joined: Jan 17, 2003
Posts: 68
|
|
|
Have a look at the character encoding of the database. If the encoding of the database is cp850 and you are trying to store unicode data then you will have a problem.
|
 |
 |
|
|
subject: About character encoding
|
|
|