Hello yilmaz,

Thursday, November 29, 2001, 12:08:33 PM, you wrote:

y> Thanks Anthony,
y> below is the header of my troublesome jsp page.

y> <%@  page language="java" contentType="text/html; charset=utf-8" %>
Sorry, about my idea with utf8 instead of utf-8 - the iana registry
has utf-8 not utf8.
y> <%@ page
y> import="java.sql.*,java.text.DateFormat,java.lang.Math,java.util.*,com.oreil
ly.servlet.*"%>

y> when charset is set to big5 , there is no problem.
y> Since my OS is Win 2000 traditional chinese, its default charset is big5,
y> so  i didn't need a special editor for big5 charset.
y> Now you say, to set charset to utf8 i need a utf8 specific editor?
y> i didn't hear this before?
Yes, this is my reading of the jsp 1.1 spec.
On page 47 it says:

contentType Defines the character encoding for the JSP page and for the response
            of the JSP page and the MIME type for the response of the JSP page.
y> can you please make it clearer?
I say that the encoding of the .jsp file should be exactly the one
specified as contentType="text/html; charset=xxx", so in your case
it should be utf-8.

So these files either have to
 1 - be created with a utf-8 capable editor
or
 2 - be coverted from Big5 to utf-8
y> E.g where can i get it?
Sorry, i am not an expert at this, but:

Let us consider the two available alternatives

  1 - use a utf-8 capable editor

    I personally use Unicedit by H. Eichmann,
    it's freeware.

    I do not know if it will work okay with
    chinese but it might.

    Unfortunantly i can not supply you with a
    url right now, but i downloaded it from
    somewhere.

  2 - convert files from Big5 to utf-8

    2.1 - open the file in Big5 encoding
          and save it in utf-8 encoding by an editor that
          is capable of both reading Big5 files
          and saving utf-8 files.

          My version of Unicedit (2.1)
          does not support reading Big5.

    2.2 - get some program to convert the files
          from Big5 to utf-8.
          I can not advise any.

    2.3 - if you're using windows Notepad, then
          it might work to click the "save as
          Unicode" checkbox in the "save file"
          dialog box and then convert your
          file from Unicode to Utf8.
          The conversion is very straightforward,
          maybe you can find some program to do
          that or write your own. (It shouldn't
          be difficult to do that say in C)

    2.4 - write your own Java app that does the
          conversion from Big5 to utf-8.
          It should be rather easy,
          as Big5 is supported by Java platform,
          according to the
          <jdk-docs>/guide/intl/encoding.doc.html

          All you have to do is

          import java.io.*;

          public class Convert{
            public static void Main( String args[] ){
              Reader r =
                new InputStreamReader(
                  new FileInputStream( args[0] ),
                 "Big5"
                );
              Writer w =
                new OutputStreamWriter(
                  new FileOutputStream( args[1] ),
                 "utf-8"
                );
              char c[] = new char[256];
              int cnt;
              while( (cnt = r.read( c )) > 0) w.write(c);
            }
          }

          I haven't tested this, but it should be smth like this

    2.5 - use Ant task to do the conversion.
          As far as understand currently none of the Ant
          tasks does this.

PEOPLE, PLEASE CORRECT ME IF I AM WRONG, IS THERE AN ANT TASK
TO CONVERT THE ENCODING?

          Maybe this should be better discussed in the Ant
          mail list at jakarta.apache.org.

          Anyway, it shouldn't be _too_ difficult to
          develop a new Ant task to do that, maybe
          the <copy> task should be modified into
          the new one.

          I think this is a usefull functionality
          so maybe you should ask people on the Ant
          mail list if anyone has already developed such.

y> thanks  a lot in advance
You're welcome :-)
y> cheers :)
Same here!

Anthony Tagunov
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to