cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: Encoding problems
Date Tue, 14 Mar 2000 17:02:03 GMT
On Tue, 14 Mar 2000, [iso-8859-2] MORÁVEK Peter wrote:

> I haveproblems with encodings. I use ISO-8859-2 to support 
> Slovak Characters in my html (through xml->xslt->html) output. 
> Input is read from a file with ISO-8859-2 characters, 
> but the only response I receive in html for some characters 
> is th question character (?).
> 
> I've looked through the source code for Cocoon and I've found
> this in the org.apache.cocoon.producer.ProducerFromFile class:
> 
>     
> public Reader getStream(HttpServletRequest request) throws IOException {
>   File file = new File(Utils.getBasename(request, this.context));
>   this.monitor.watch(Utils.encode(request), file);
>   return new InputStreamReader(new FileInputStream(file)); // <-- WRONG
> }
> 
> I think, there should be:
> 
>   return new InputStreamReader(new FileInputStream(file), 
>     encoding); // <-- CORRECT
> 
> So I can anywhere in cocoon.properties set the encoding for the 
> input stream.

This would work, but then you're setting the encoding globally for all XML
files. I'm _not_ an i18n expert, but I reckon that a better solution would
be to read the encoding from the XML source file and use that for the
encoding of the output. Maybe Pier has some thoughts on this though.

- donald


Mime
View raw message