inspecting the PdfStamper class, I am noticing all code relies in the
OutputStream class, which does not consider characters encoding while
flushing its contents:

            while ((n = file.read(buf)) > 0)
                this.os.write(buf, 0, n); <-- output stream is just
byte printer :(

if we can use Writers instead, we gain full control over what kind of
encoding is being used to writes the characters:

          writer = OutputStreamWriter(this.os, new Charset("UTF-8",
new String("utf-8"));
            while ((n = file.read(buf)) > 0)
                writer.write(buf, 0, n); <-- now we can handle the
correct encoding :)

@see: http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStreamWriter.html

just a guess....


On 8/6/07, Felipe Gaúcho <[EMAIL PROTECTED]> wrote:
> I suppose it is Unicode.. my question is about a configuration to change it...
>
> Since iText offer me a reader and a writer classes, I was looking for
> some configuration somewhere :))
>
> On 8/6/07, Felipe Gaúcho <[EMAIL PROTECTED]> wrote:
> > the PdfStamper uses what encoding ?
> >
> > On 8/6/07, Felipe Gaúcho <[EMAIL PROTECTED]> wrote:
> > >                InputStream templateStream = ...
> > >                PdfReader templateReader = new PdfReader(templateStream);
> > >
> > > This PdfReader is using what encoding ?
> > >
> > > Can I configure it to use a charset or I must create a String before
> > > to use the PdfReader ?
> > >
> > > The other option is to use the toString method of the
> > > ByteArrayOutputStream in order to set the encoding....
> > >
> > >
> > >
> > >
> > >
> > > On 8/6/07, Paulo Soares <[EMAIL PROTECTED]> wrote:
> > > >
> > > > ----- Original Message -----
> > > > From: "Felipe Gaúcho" <[EMAIL PROTECTED]>
> > > > To: "Post all your questions about iText here"
> > > > <[email protected]>
> > > > Sent: Monday, August 06, 2007 11:35 AM
> > > > Subject: Re: [iText-questions] charset problems
> > > >
> > > >
> > > > > depending on the charset of the input I get wrong output.. how can I
> > > > > manage if it is UTF-8 or ISO-... ?? there is a configuration somewhere
> > > > > ?
> > > >
> > > > You are confusing Unicode with Unicode representation. A java String is
> > > > Unicode. UTF-8 is an Unicode representation. There are constructors in 
> > > > the
> > > > java String that can convert from an Unicode byte representation to the
> > > > String itself. All this is beyond the iText scope but if you are more
> > > > specific we may be able to help you (posting the code is ok but you must
> > > > point to the problematic line).
> > > >
> > > > Paulo
> > > >
> > > >
> > > > -------------------------------------------------------------------------
> > > > This SF.net email is sponsored by: Splunk Inc.
> > > > Still grepping through log files to find problems?  Stop.
> > > > Now Search log events and configuration files using AJAX and a browser.
> > > > Download your FREE copy of Splunk now >>  http://get.splunk.com/
> > > > _______________________________________________
> > > > iText-questions mailing list
> > > > [email protected]
> > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > > Buy the iText book: http://itext.ugent.be/itext-in-action/
> > > >
> > >
> >
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to