hi everyone,
if you have nothing to do with chinese characters you can simply ignore this
message
this mail is for those who followed the thread about " inserting chinese
characters into SQL server through a servlet" .
after trying all possible methods to force my servlet to insert chinese
chars correctly, i tried this mailing list , (which didn't help either), i
searched the bug list of tomcat, and saw that this a known bug.Then i began
looking for a workaround for my problem. Thanks God, at last i found the
solution and my servlet works perfectly, though it was not as easy as SOME
people thought  as a simple CATCHING AN EXCEPTION   =) .
here i just wanted to share my experience so that the others may save time
and solve their problems.

the only solution  that worked for me  to insert chinese chars into a
database (at least SQL 2000 and MS Acces 2000 ) is using the ParameterParser
class which is bundled with oreilly package (and can be downloaded from
www.servlets.com) .

The following is the generally used method and is not working for tomcat
(3.2.2 - 4) :
 String formVariable=req.getParameter("formVariable");
String myVariable=new String(formVariable.getBytes("iso-8859-1"),big5);

the following method works  (from Jason's book):
ParameterParser parser=new ParameterParser (req);
parser.setCharacterEncoding("big5");
String myVariable=parser.getStringParameter("formVariable");

one more thing you should be aware of is:
if the datatype of hte field in SQL 2000 database is char or varchar it is
NOT WORKING, either.
you SHOULD change the datatype as text.
hope it helps those who are having the similar problems
cheers :)







_______________________________________________________
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to