W3C home > Mailing lists > Public > www-international@w3.org > July to September 2005

Re: New article for REVIEW: Changing page encoding to UTF-8

From: Frank Yung-Fong Tang <ytang0648@aol.com>
Date: Thu, 11 Aug 2005 16:23:59 -0400
To: "Richard Ishida" <ishida@w3.org>
cc: www-international@w3.org
Message-ID: <42FBB3DF.4060709@aol.com>

This is comment for related document, but not exactly the one you point 
out.

1. Can you change the example in
http://www.w3.org/International/O-HTTP-charset

from

The line in the HTTP header typically looks like this:

     Content-Type: text/html; charset=iso-8859-1

to

The line in the HTTP header typically looks like this:

     Content-Type: text/html; charset=UTF-8

I know it is just an example in a different page, but some dump person 
sometime just like to copy code from example. And I think it is nice to 
let those dummer to copy UTF-8 instead of ISO-8859-1 even either of them 
are bad choice to hard code.

2. Also, in http://www.w3.org/International/O-HTTP-charset
"For Java Servlets, use the setContentType  method on the 
ServletResponse before obtaining any object (Stream or Writer) used for 
output, e.g.:
resource.setContentType ("text/html;charset=utf-8");
If you use a Writer, the Servlet automatically takes care of the 
conversion from Java Strings to the encoding selected."

I think this infor is only recommend for the use of J2EE 1.3. The J2EE 
1.4 change it by adding the setCharacterEncoding(java.lang.String)  method.

in 1.4 version of J2EE ServletResponse document
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletResponse.html
"The charset for the MIME body response can be specified explicitly 
using the setCharacterEncoding(java.lang.String) and 
setContentType(java.lang.String) methods, or implicitly using the 
setLocale(java.util.Locale) method. Explicit specifications take 
precedence over implicit specifications. If no charset is specified, 
ISO-8859-1 will be used. The setCharacterEncoding, setContentType, or 
setLocale method must be called before getWriter and before committing 
the response for the character encoding to be used."

You should mention the  setCharacterEncoding(java.lang.String) there for 
J2EE 1.4.



Richard Ishida wrote on 8/11/2005, 1:09 PM:

 >
 >
 >
 >
 > Title: Changing page encoding to UTF-8
 > http://www.w3.org/International/questions/changing-encoding
 >
 > Comments are being sought on this article prior to final release.
 > Please send any comments to www-international@w3.org. We expect to
 > publish a final version in one to two weeks.
 >
 > The article aims to answer the question: "How do I change the encoding
 > of my (X)HTML pages to UTF-8?"
 >
 >
 > ============
 > Richard Ishida
 > W3C
 >
 > contact info:
 > http://www.w3.org/People/Ishida/
 >
 > W3C Internationalization:
 > http://www.w3.org/International/
 >
 > Publication blog:
 > http://people.w3.org/rishida/blog/
 >
 >
 >
Received on Thursday, 11 August 2005 20:24:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 19:17:05 GMT