Scrive Antonio Petrelli <[EMAIL PROTECTED]>:

> John-Paul Delaney ha scritto:
> > Hello List...  my first attempt at i18n is failing.
> >
>
> Are you using resource bundles? Or what? If yes, please post a reply
> because the answer will be very different from the one below.
>
> > I've converted MS smart quotes to utf 2019 symbol (right single quote) in
> my VIM
> > editor after setting encoding to UTF-8.  The quote displays ok in vim but
> in the
> > browser it displays badly ( in firefox - a+circumflex, and IE -
> > a+circumflex+garbage ).
> >
> > The http servlet response content type character set is UTF-8.
> >
> > I don't understand where I'm losing the utf encoding of the text.
> >
> > Any assistance is greatly appreciated.
> >
> > Tomcat 5.0.28 on FreeBSD.
> >
>
> I assume that you want to display the content of a text file as a response.
> The best approach is to separate the file encoding from the servlet
> response encoding.
> You should read the file using InputStreamReader around a
> FileInputStream with your preferred encoding. Then you should write the
> content using HttpServletResponse.setCharacterEncoding and then
> HttpServletRequest.getWriter
> Another (bad, from my point of view) approach is to read through
> FileInputStream and write through HttpServletResponse.getOutputStream. I
> think it's wrong because you could have one encoding for the file and
> another for the response.
> Ciao
> Antonio
>

Bravo Antonio... yes I forgot to say I'm using propterties file backed
resourcebundles.  A little earlier I found out that they can only use Latin1
encoding, and I had to use the native2ascii tool to convert non-ascii
characters to their \uxxxx code.  It's a little laborious but at least it's
working now.

many thanks
/j-p.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to