|
hi all,
i need urgent help with this problem
i wrote a message board servlet which works
perfect
but with English characters only.
i searched all the archives , i found some similar topics but
none of those solutions suggested worked.
even surprisingly Jason' s example in java servlet programming
book
in chapter 13 doesn't work for taiwan chinese characters
(big5).
i need to enable my servlet to input chinese characters (big5)
via a html form.
in other words when a user submits his/her message, the
form must be able to handle these big5 characters , send them to hte servlet,
and the servlet will save them in to the ms access database via prepared
statment.
by the way i already defined the content type and charset of
my html page with the following code snippets:
res.setContentType("text/plain;
charset=big5");
PrintWriter out =
res.getWriter();
res.setHeader("Content-Language","zh-TW"); i also trie d charset= UTF-8, didn't work
when i manually enter some chinese text into the database, the
servlet is able to read the chinese characters correctly, but it can't insert
chinese characters. In fact it inserts some strange letters .
please can anyone give me a useful suggestions.
in form handling part of my code i used the following (as
Jason suggests in his book)
String Name = req.getParameter("name");
name=new String(Name.getBytes("ISO-8859-1"),Big5); i also tried
byte[] name=new String(name.getBytes(),Big5);
as well as other possible solutions
can anyone rescue ! me from this trouble
please
thanks in advance .
cheers
yilmaz
|
