Whoops. Ignore the "html" variable name, it should be "foFile".

On 11/30/05, Craig McDaniel <[EMAIL PROTECTED]> wrote:
> OK, I was able to get one of the question marks to go away (leaving a
> single question mark where the space should be). Here is what I
> changed:
>
> serializer.setOutputStream(new PrintStream(new
> FileOutputStream(results), false, "UTF-8"));
>
> and to read the file....
>
> InputStreamReader fileReader = new InputStreamReader(new
> FileInputStream(html), "UTF-8");
> BufferedReader reader = new BufferedReader(fileReader);
> log.debug("Encoding for " + html + ": " + fileReader.getEncoding());
>
> ....this prints "UTF8" as the encoding (without the dash). What's up
> with that? Anyway, I think we are getting closer.
>
> On 11/30/05, Craig McDaniel <[EMAIL PROTECTED]> wrote:
> > I've been able to debug this a little bit, and it seems that, even
> > though I am setting the output encoding to UTF-8, it is being written
> > as ASCII. Since we can't get much farther without posting code, here
> > goes:
> >
> >   Serializer serializer = SerializerFactory.getSerializer(props);
> >   log.debug("Output Encoding: " +
> > serializer.getOutputFormat().getProperty("encoding"));
> >   serializer.setOutputStream(new FileOutputStream(results));
> >   filters[lastFilter].setContentHandler(serializer.asContentHandler());
> >   filters[lastFilter].parse(new InputSource(new FileReader(xmlFile)));
> >   log.debug("Finished the transformation");
> >
> > The first log message indeed prints "Output Encoding: UTF-8". However,
> > when I create a FileReader for this same File ("results" in the code
> > above), and do file.getEncoding(), it prints "ASCII". Also, when I
> > look at the file with less, I see "General<C2><A0>Electric" and in
> > emacs, I see "General??Electric". This is just an XSL transform up to
> > this point, nothing FOP-specific (though the file is a FO document),
> > so perhaps the Xalan list is the proper place for this question?
> >
> > Here is the code for the Reader:
> >
> >   FileReader fileReader = new FileReader(foFile);
> >   BufferedReader reader = new BufferedReader(fileReader);
> >   log.debug("Encoding for " + foFile + ": " + fileReader.getEncoding());
> >
> > Again, this prints "Encoding for /tmp/quarterly40215.xml: ASCII". At
> > this point, the reader is used to read the file into a byte array.
> > Then it is wrapped in a ByteArrayInput stream and fed to the FOP
> > Driver. Are we any closer?

--
Craig McDaniel

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

Reply via email to