[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Quick question about encoding
Encoding characters to bytes is the last stage of the serialization process. If you write to a character destination rather than a binary destination then this stage is skipped: Saxon writes Unicode characters to the StringWriter, and the requested encoding has no effect. It would only have an effect if you wrote to a binary destination such as an OutputStream. Regards, Michael Kay http://www.saxonica.com/ http://twitter.com/michaelhkay > -----Original Message----- > From: Bartolomeo Nicolotti [mailto:bnicolotti@xxxxxxxxx] > Sent: 24 February 2010 15:00 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: Quick question about encoding > > Hello, > > I use saxon as a xslt 2.0 engine in Java with code that uses > simple strings like: > //create transformer > 1) TransformerFactory tfactory = getTransformerFactory(); > 2) Transformer transformer = > tfactory.newTransformer(new StreamSource(xslt)); > //set encoding > 3) > transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1"); > 4) StringWriter sw = new StringWriter(); > 5) Result result = new StreamResult(sw); > > //transorm > 6) transformer.transform( new StreamSource(new > StringReader(xml_in)), result); > > //obtain translated > 7) String translated_str = sw.toString(); > > As here we've all Java strings has line 3) some effect? > Shouldn't be all the Java String object UNICODE? > > Many thanks > > Best regards > > Bartolomeo Nicolotti > > > -- > ____________________________________________________________ > Bartolomeo Nicolotti - Reparto Sviluppo - SIAP s.r.l. > Via Sant'Albano, 13 - 12049 TrinitC (CN) Italy Tel. (+39) > 0172 652511 - Fax (+39) 0172 652519 > E-mail: bnicolotti@xxxxxxxxx - URL: www.siapcn.it Codice > Fiscale, Partita IVA, Iscr. Reg. Imprese di Cuneo: > 01871320048 Capitale Sociale: b, 99.000,00 i.v. - R.E.A. CN > 141311 ____________________________________________________________ > > Le informazioni contenute nella presente comunicazione e i > relativi allegati possono essere riservate e sono, comunque, > destinate esclusivamente alle persone o alla SocietC > sopraindicati. La comunicazione, diffusione, distribuzione > e/o copiatura del documento trasmesso nonchC) qualsiasi forma > di trattamento dei dati ivi contenuti da parte di qualsiasi > soggetto diverso dal destinatario C( proibita, sia ai sensi > dell'art. 616 c.p., che ai sensi del D. Lgs. n. 196/2003, ed > in ogni caso espressamente inibita. Se avete ricevuto questo > messaggio per errore, vi preghiamo di distruggerlo e di > informarci immediatamente per telefono allo 0172/652511 o > inviando un messaggio all'indirizzo: > info@xxxxxxxxx > ____________________________________________________________ > > This electronic mail transmission, including any accompanying > documents or attachments, may contain information that is > confidential, privileged, proprietary, or otherwise legally > exempt from disclosure and it's intended solely for the > addressee(s). Access to this Internet electronic mail > message by anyone else is unauthorized. If you are not the > intended recipient, any disclosure, copying, distribution or > any action taken or omitted to be taken in reliance on it is > prohibited and may be unlawful. If you have received this > electronic mail erroneously, we ask you to to destroy it and > let us know immediately by phone at 0172/652511 or by sending > an e-mail at info@xxxxxxxxx > ____________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|