[prev in list] [next in list] [prev in thread] [next in thread] 

List:       batik-users
Subject:    Re: PDFTranscoder and german umlaut
From:       Jeremias Maerki <dev () jeremias-maerki ! ch>
Date:       2007-12-18 8:48:05
Message-ID: 20071218094334.ACCC.DEV () jeremias-maerki ! ch
[Download RAW message or body]

Are you 100% sure that the String you supply has been constructed
correctly? People often run into problems such as these if the Strings are
constructed from byte arrays or InputStreams with the wrong encoding
specified. In my experience, in about 70% of the cases I've seen, people
who have their XML in a java.lang.String have done something
strange/wrong with encodings earlier.

On 18.12.2007 08:49:07 Mork0075 wrote:
> I've tried to change the encoding but this doesnt work.
> 
> Now i create a temp file from the svg and instead of providing an
> StringReader
> 
> new TranscoderInput(new
> StringReader(svgMsg));
> 
> i provide the URI for the file
> 
> new TranscoderInput(file.toURI.toString());
> 
> This works fine. Any ideas why this is the case?
> 
> 
> 
> Robert Lummert schrieb:
> > Hello Mark,
> >
> > I use umlauts myself and have no problem transcoding to pdf with very
> > much the same code as yours. Which xml-encoding do you use in the svg?
> > I use
> >  <?xml version="1.0" encoding="ISO-8859-15"?>
> > and simply write out the umlauts in the svg.
> > The result is correct in svg as well as in transcoded pdf.
> >
> > Cheers,
> >
> >      Robert
> >
> >
> > Mork Ork wrote:
> >   
> >> Hello,
> >>
> >> i try to transform a SVG string into a PDF. But now where i have to use
> >> german umlauts like Ä,Ö,Ü theres a problem:
> >>
> >> My SVG is in UTF-8 and looks like this:
> >>
> >> id="tspan6095">(2) Abladestelle - Lagerort -
> >> Verwendungsschlüssel</tspan></text>
> >>
> >> If i transcode it into PDF its not properly encoded, there are some
> >> hieroglyph instead of the umlauts.
> >>
> >> This is my code:
> >>
> >>     public static String convert(String svgMsg, String labelId) {
> >>
> >>         File pdf = new File(labelId + ".pdf");
> >>         OutputStream outputStream;
> >>         try {
> >>             outputStream = new FileOutputStream(pdf);
> >>             PDFTranscoder transcoder = new PDFTranscoder();
> >>             TranscoderInput input = new TranscoderInput(new
> >> StringReader(svgMsg));
> >>             TranscoderOutput output = new TranscoderOutput(outputStream);
> >>             transcoder.transcode(input, output);
> >>             outputStream.flush();
> >>             outputStream.close();
> >>
> >> Can anyone tell me how to deal with the umlaut?
> >>
> >> Thanks a lot
> >>
> >>     


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic