RE: JSP containers and default charset (was: Re DefaultCharset considered harmful)

On Sun, 30 Nov 2003, Addison Phillips [wM] wrote:

Hi Addison,

Thanks for the clarification. The more I wrote about it, the clearer it
became how ignorant I am about JSP (which I took up just a week ago).

> > Someone might argue that there need to be two separate 'directives' for
> > two roles, but I guess it's all right to overload pageEncoding directive.


> Not quite: there are two directives: pageEncoding and contentType and they
> can indicate *different* encodings. If you use pageEncoding on its own, it
> is assumed that the encoding of the source JSP file should be the encoding
> used to deliver the file. If you use contentType on its own, then the page
> is delivered in the encoding specified, but read as Latin-1. If you want to
> use one encoding (say KS-X-1001) for the JSP file and a different encoding
> for the delivery (say UTF-8) then you can use both directives together.

  Here's one thing I know more than you do :-). KS X 1001 is not a
character encoding scheme but just a coded character set without
Latin letters, numbers and punctuations so that on its own it's
virtually useless. It always has to be used along with US-ASCII (ISO
646:IRV)/ISO-646:KR in CES'(character encodings/MIME charset) like EUC-KR
and ISO-2022-KR. That is, virtually NONE of Korean text can be written
with characters drawn _only_ from KS X 1001. When it comes to JSP, it's
even more so because all those ASCII charcters are NOT covered by KS X
1001 unless javac somehow can understand double/full width Latin letters,
numbers and punctuations in KS X 1001, which I don't think is the case.


> For example, see Norbert Lindeberg's excellent article here:
> http://developer.java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/
... snip (good tips/advices) ...

Thanks again for the reference and tips.

BTW, wouldn't it be nice if it's possible to specify the DTP with a
simple JSP directive instead of having to include it verbatim?  I wrote
a macro for my editor so that I can enter DTDs for xhtml 1.0 and html
4.x strict/loose rather easily when I edit html/xhtml/jsp files, but a
simple JSP directive would make it a lot more pages (generated by JSP)
compliant to the standard in that they have the DTD declared.  By the same
token, it'd be nice (although not necessary because the http header is
emitted to that effect) if  'contentType' directive with __'text/html;
charset=XXXX'__ automatically adds '<meta http-equiv.....'  to <head>
if not present (the same is true of PHP. I don't know what ASP does
here.) I realize that both are rather tricky to implement given the
way JSP files are processed (as you explained in great details) before
they're delivered. Maybe, we just have to live with having to  add
DTD declation manually.

  Jungshik

Received on Monday, 1 December 2003 05:36:16 UTC