Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
Hi,
Till now our application was using Chinese and Thai characters. We used GB2312 charset and it worked verywell. But now we have got requirement to add vietnamese characters aswell. I tried different combinations of charactersets. Main concern is report generaion which will have all characters in single report. With UTF-8, Vietnamese comming correctly. With GB2312, chinese and thai coming out correctly.
Any solution to this where i can disply Vietnamese,chinese and thai characters in single report. We have JSP which generates report.
Sample Code:
<%@ page language="java"
import="javax.ejb.*,
javax.naming.*,
com.rmisasia.reports.*"
contentType="application/vnd.ms-excel"
%>
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html;charset=GB2312">
.
.
.
.
ps = con.prepareStatement("SELECT * FROM TMP_ALL_NAMETYPE ORDER BY SEQ_NO");
rs_alltype =ps.executeQuery();
while(rs_alltype.next())
{
/////Here some cell will have chinese, SOme will have thai and some will have VIETNAMESE column data.
}
ANY CHANGES REQUIRED AT DB SIDE?
Appreciate response of expert.
Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
You would have to ensure all your layers support the character set you need.
So the database, the internal code that handles the data as well as the jsp page all need to have support for the character set.
// Json
Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
Thanks for Replying Json.
You are right. But what i want to know is that which charset supports all of these languages.
Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
Should UTF-8 not work for this?
// Json
Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
Nope...UTF-8 is not working....
Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
UTF-16?
However I though UTF-8 would cover most or even ALL characters on the face of the planet :)
// Json
Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
I think not. Try generating sample JSP and use UTF-8 to store chinese and vietnamese chars.
Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
Hang on now, from reading your post at the top you're saying that using UTF-8 your JSP wont show correctly, even if you set the meta tag to use content-type and charset for UTF-8?
Have you made sure your application uses UTF-8 as default content type when sending back the response to the browser for .jsp files?
Here is a web.xml example for servlet spec 2.5, this needs to go at the bottom of the file, just before the main closing tag.
Code :
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
<trim-directive-whitespaces>true</trim-directive-whitespaces>
</jsp-property-group>
// Json