Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 8 of 8

Thread: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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="urn:schemas-microsoft-comfficeffice"
    xmlns="urn:schemas-microsoft-comffice: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.


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default 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

  3. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK

    Should UTF-8 not work for this?

    // Json

  5. #5
    Junior Member
    Join Date
    Oct 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK

    Nope...UTF-8 is not working....

  6. #6
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default 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

  7. #7
    Junior Member
    Join Date
    Oct 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  8. #8
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default 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.

    		<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
    Last edited by Json; October 23rd, 2009 at 02:40 AM.

Similar Threads

  1. instead of printing in the client, report get printed in the server
    By jmvenkat in forum Java Theory & Questions
    Replies: 0
    Last Post: September 19th, 2009, 01:30 AM
  2. Certain Chinese Characters not displayed properly.
    By kerwintang in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: August 20th, 2009, 08:23 AM
  3. [SOLVED] Getting Exception " java.util.InputMismatchException" in scanner package
    By luke in forum File I/O & Other I/O Streams
    Replies: 10
    Last Post: May 20th, 2009, 04:55 AM
  4. Program to convert Hexadecimal to its Character equivalent
    By nathanernest in forum Java Theory & Questions
    Replies: 2
    Last Post: April 8th, 2009, 03:12 AM
  5. How to read character from image area(jpg image)?
    By sundarjothi in forum Java Theory & Questions
    Replies: 5
    Last Post: August 6th, 2008, 02:08 AM