Arun Thomas wrote:
>
> Hans,
>
> I've actually seen this section of the specification, but have not
> yet been able to figure out how this could possibly be implemented.
> Since the JSP file itself contains the information which the engine
> requires to interpret the file, how does the engine extract this
> information from the file?  Unless it knows the encoding, as it were,
> it can't understand the file in order to determine the encoding.
>
> Am I just missing something obvious?

Again, the spec has the answer ;-)

  2.7.4 Delivering Localized Content
  The contentType attribute must only be used when the character encoding
  is organized such that ASCII characters stand for themselves, at least
  until the contentType attribute is found. The directive containing the
  contentType attribute should appear as early as possible in the JSP page.

In other words, if all characters upto and including the contentType
attribute are all ASCII, the JSP container can read the file using a
Latin-1 encoding until it finds it. If the contentType specifies a
different encoding, it needs to reopen the file with a new Reader and
read the rest of the file. In theory it looks like it would work, but
it may not be flexible enough to handle all common situations. I18N
is therefore one of the areas to be looked at again for the next version
of the spec.

Hans

> > -----Original Message-----
> > From: Hans Bergsten [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, April 11, 2000 9:57 AM
> > To: Arun Thomas
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: localization
> >
> >
> > Arun Thomas wrote:
> > >
> > > Govind,
> > >
> > > Maybe my posting confused two issues....  One of my issues had
> > to do with
> > > ResourceBundles.  I hadn't been able to find any documentation in the
> > > JavaDocs
> > > which specified the encoding used for property resource bundles - it
> > > appears,
> > > from the info that Vyacheslav Pedak recently posted, that I
> > didn't read it
> > > well enough....
> > >
> > > The second issue, however, was specific to JSP engines....  I
> > was trying to
> > > understand how the engines can determine the encoding used for
> > storing the
> > > JSPs.
> > > In the case of JSPs, I think the it would becoming incredibly
> > difficult to
> > > use
> > > if every non ISO-8859-1 character had to be unicode escaped....  Do JSP
> > > engines
> > > use a default encoding for reading in JSP pages in order to
> > interpret and
> > > compile
> > > them into servlets?
> >
> > JSP 1.1 says this:
> >
> >   2.7.4 Delivering Localized Content
> >   The JSP 1.1 specification assumes that JSP pages that will deliver
> >   content in a given character encoding will be written in that character
> >   encoding. In particular, the contentType attribute of the page
> > directive
> >   describes both the character encoding of the JSP page and the character
> >   encoding of the resulting stream.
> >
> > Hans
> > --
> > Hans Bergsten         [EMAIL PROTECTED]
> > Gefion Software               http://www.gefionsoftware.com
> >


--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
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