Hi,
There are some things to be done like setting charset for chinese characters
in html,
And in servlet, setting contentType charset="the charset that supports
chinese".

I have documented all these.
Refer to it. I am sending to ur personal-id.

Regards
Praveen Tapashetti
Mascot Systems Ltd
Chennai, India

Tel:   91-44-2301236 Extn: 3321


        -----Original Message-----
        From:   Alex Amies [SMTP:[EMAIL PROTECTED]]
        Sent:   Friday, March 09, 2001 7:13 AM
        To:     [EMAIL PROTECTED]
        Subject:        web site internationalization

        I have a problem manipulating utf-8 strings in servlets.  The output
        appears garbled.  For example, the servlet below should show a page
        with the Chinese translation for 'logon', consisting of the two
        characters ? (u\767b, deng)  ? (u\5165, ru), but the result is
garbled:

            public void service(HttpServletRequest request,
HttpServletResponse
        response)
                    throws ServletException, IOException {
                response.setContentType("text/html; charset=UTF-8");
                //PrintWriter out = response.getWriter();
                ServletOutputStream out = response.getOutputStream();
                out.println("\u767b\u5165");
                Locale locale = new Locale("zh", "CN");
                ResourceBundle bundle = ResourceBundle.getBundle("UTF8",
        locale);
                String country = bundle.getString("country");
                out.println(country);
                out.close();
            }

        The String 'country' (??) is looked up from a resource bundle and
        printed correctly
        in Chinese after it but not on the next line .  What's up here?

        The interesting thing is this:  When I switch the
        response.getOutputStream() line
        with the commented out line response.getWriter() the opposite
happens.
        'Logon' is
        now printed correctly and 'country' is garbled.  Interesting.

        The frustrating point is this:  I am using xslt to translate xml to
html
        and the
        whole lot seems to be garbled, whichever I use.  I am using Apache
        Xalan.  The
        same code will work if writing to a file from a stand-along app
instead
        of from
        a servlet to a browser.

        Alex Amies


___________________________________________________________________________
        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

___________________________________________________________________________
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