----- Original Message -----
From: "Garth Somerville" <[EMAIL PROTECTED]>



> There are two separate issues in this section that perhaps the spec means
to
> relate in a way that I am missing.
>
> The question is how the container is expected to relate these two, if at
> all.  If the servlet intends for any character encoding other than
> ISO-8859-1 to be used then shouldn't she have to specify it using the
> charset parameter of the content type?

Yes the servlet *may* specify it as part of the content type.

>  Or does the spec mean to imply that
> the container should examine the locale and attempt to choose one of the
> ISO-8859-X character sets, adding a charset parameter to whatever content
> type the servlet specifies?

My understanding is as follows:

The servlet should set either the locale or the charset in content type
header otherwise the container defaults to ISO-8859-1.
1. If only the locale is set, then the container should  set the appropriate
character set in the content-type and use this locale for encoding in the
PrintWriter.
2. If only the character set is specified, then this is used for encoding in
the PrintWriter.
3. If the servlet sets the locale and then the content type the behavior is
defined by the specs as follows (sec 5.4)

"If the setContentType method is called after the setLocale method and there
is a
charset component to the given content type, the charset specified in the
content type
overrides the value set via the call to setLocale."

4. I am not sure what is the behaviour if the servlet first sets the content
type and then the locale. I think the charset part of the content type
should be used by the PrintWriter for encoding. Can someone please clarify
this.

Of course all this is applicable before the call to getPrintWriter(). Once
the PrintWriter is asked for, any change in the setting of locale or charset
will not affect the behaviour of the PrintWriter. That is why the specs say
that the servlets *should* specify content type/locale before asking for
PrintWriter.

Please correct me if my understanding here is incorrect.

Regds,
Gokul

>
> -Garth
>

___________________________________________________________________________
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