Jakub,

"Maybe there are encodings where the first 128 characters are
 not the same as in ascii, but there's no need to use them as
 we've got UTF-8; the Unicode Transformation Format use the
 same mapping for ascii."

You've hit upon the key point here.  There definitely are
encodings where the first 128 characters are not the same as in
ascii.  (The most obvious of these is Unicode itself - all
characters including the ascii characters are encoded with two
bytes.)  There is no "need" to use them, as you suggest, but
this can only be completely enforced by specifying the encoding
which one uses to store text files.  Currently, there is no
stated requirement for the encoding used to store a JSP file.

"In fact there's no need to read the jsp file as a byte stream,
 you simply need to read it as ISO-8859-1 since the jsp directives
 along with the Java code will always be ascii characters and you
 can ignore the rest for the moment."

I disagree that the JSP directives and the ascii code will necessarily
always be ascii.  Parameter values in the JSP directives could be
non-ascii, as could hardcoded strings in the code portion. For example:

<jsp:setProperty name="JapaneseBean" property="CountryName" value="--Could
be non Ascii-text" />

-AMT

> -----Original Message-----
> From: Jakub Murin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 07, 2000 12:13 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: need help with setting charsets in JSP pages
>
>
> Hello Arun
>
> you wrote:
>
> > I agree that you can indeed load files as streams of
> > bytes and decide
> > interpretation
> > later.  However, it is not clear to me that you
> > could make this decision
> > based on
> > the contents of the file you load.  You must
> > interpret your stream of bytes
> > someway
> > in order to understand the portions of the file that
> > instruct how to
> > interpret the file.
> > As you can see, this causes a sort of loop - you
> > must interpret the file
> > correctly in
> > order to interpret it correctly.
>
> It's the simplest thing in the world and if people who
> made those crappy jsp engines don't know how to do
> that I can only regret them.  In fact there's no need
> to read the jsp file as a byte stream, you simply need
> to read it as ISO-8859-1 since the jsp directives
> along with the Java code will always be ascii
> characters and you can ignore the rest for the moment.
>  Well, parse the file to find the directive
> contentType and read the file again this time using
> the correct encoding.  I can't see the problem.  Maybe
> there are encodings where the first 128 characters are
> not the same as in ascii, but there's no need to use
> them as we've got UTF-8; the Unicode Transformation
> Format use the same mapping for ascii.
>
> > This tag corresponds to the servlet
> > response.setContentType("text/html")
> > command.  (If you look at the generated servlets,
> > you see that this is how
> > the
> > tag is translated.)
>
> if you have a look at sevlet API documentation you'll
> see what the parameter of that method means:
>
> public void setContentType(java.lang.String type)
> ...
> type - a String specifying the MIME type of the
> content
>
> The fact that you don't specify charset only means
> that the default, which is ISO-8859-1, will be used.
> I always specify the full MIME type, for example
> response.setContentType("text/html;
> charset=ISO-8859-2") or with any other charset and
> fortunately it works perfectly, that's why I've never
> had problems sending html content in any encoding from
> my servlets.
>
> Jakub
>
> ___________________________________________________________
> Do You Yahoo!?
> Achetez, vendez! � votre prix! Sur http://encheres.yahoo.fr
>

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

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to