Hurray... It worked for me..

 
I replaced  StringReader with input steam and it worked...
as pascal told.. StringReader was the culprit.. converting bytes to string lost 
UNICODE information..

Here's what I did



         ByteArrayOutputStream stream = new ByteArrayOutputStream();
         StreamResult result = new StreamResult(stream);
 
        Source xmlSource = new JDOMSource(document);
        transformer.transform(xmlSource, result);
 
         ByteArrayOutputStream out = new ByteArrayOutputStream();
        Driver driver = new Driver(new InputSource(new 
ByteArrayInputStream(stream.toByteArray()) ), out);
          driver.run();
         return out.toByteArray();
  
              And it worked.. 

Thanks Pascal, Thank you very much.. 

SN

Personally I'm always ready to learn, although I do not always like being taught
  




________________________________
From: "[email protected]" <[email protected]>
To: [email protected]
Sent: Tue, 10 November, 2009 11:40:25 AM
Subject: Re: AW: Zero width space is displayed as junk character [â€] in PDF




 Then what is the solutions in my case.. 

  

Personally I'm always ready to learn, although I do not always like being taught
  




________________________________
From: Pascal Sancho <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Mon, 9 November, 2009 9:23:07 PM
Subject: Re: AW: Zero width space is displayed as junk character [â€] in PDF

Hi,

I don't think that using ByteArray is a good pratice for XML stream, because 
you loose the codage information:
some characters may be encoded with 2 (or 3) bytes in utf-8, and after 
conversion into Bytes, you get 2 (or 3) bytes...
after that, coming back to String conversion, you get a 2 (or 3) chars length 
string, expalining what you get in your XML text file.

You should ensure that your XML streaming is not converted into Bytes at any 
time.

Pascal

[email protected] a écrit :
> Thanks you very much...
> 
> Then why doesn't it work for me.. When I see document property in Acrobat 
> reader.. it shows me same fonts...
>  
> This is how I get bytes
> 
> 
>         ByteArrayOutputStream stream = new ByteArrayOutputStream();
>         StreamResult result = new StreamResult(stream);
> 
>        Source xmlSource = new JDOMSource(document);
>        transformer.transform(xmlSource, result);
> 
>         ByteArrayOutputStream out = new ByteArrayOutputStream();
>         Driver driver = new Driver(new InputSource(new 
> StringReader(stream.toString())), out);
>         driver.run();
>         return out.toByteArray();
>  
> *Thanks
> SN*


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


________________________________
 From cricket scores to your friends. Try the Yahoo! India Homepage!


      Keep up with people you care about with Yahoo! India Mail. Learn how. 
http://in.overview.mail.yahoo.com/connectmore

Reply via email to