ปัญหาการรับค่าภาษาไทยใน JSP แก้ไขได้มั้ย
posted on 31 Oct 2007 09:55 by pommatt in JAVAได้ครับผมเขียน method ไว้ตามนี้
public synchronized String convertToUTF8(String value){ // lock thread
String strThai ="";
try{
strThai = new String(value.getBytes("ISO8859_1"),"utf-8");
}catch(Exception ex){
System.out.print("Error convertToUTF8");
}finally{
return strThai;
}
}
เวลาใช้ก็เขียนดังนี้ หลังจากมีการ submit มานะครับ
String option = (String)convertToUTF8(request.getParameter("option"));
จบแล้วครับ
edit @ 31 Oct 2007 10:01:21 by Pom & Ja
#1 By pureroot (58.8.173.88) on 2008-06-07 09:40