Return-Path: Mailing-List: contact xalan-j-users-help@xml.apache.org; run by ezmlm Delivered-To: mailing list xalan-j-users@xml.apache.org Received: (qmail 97452 invoked from network); 16 Jul 2001 15:31:27 -0000 Received: from lotus2.lotus.com (129.42.241.42) by h31.sny.collab.net with SMTP; 16 Jul 2001 15:31:27 -0000 Received: from internet2.lotus.com (internet2 [172.16.131.236]) by lotus2.lotus.com (8.11.4/8.11.4) with ESMTP id f6GFVrx02103; Mon, 16 Jul 2001 11:31:53 -0400 (EDT) Received: from cammail03.lotus.com (cammail03.lotus.com [9.95.5.58]) by internet2.lotus.com (8.11.4/8.11.2) with ESMTP id f6GFV0w11781; Mon, 16 Jul 2001 11:31:00 -0400 (EDT) Subject: Re: Reader buggy for transformation? (Was: Re: Force encoding of resultdoc) To: Gary L Peskin Cc: Scott_Boag@lotus.com, bjoern.martin@gmx.net, xalan-j-users@xml.apache.org, Donald_Leslie@lotus.com X-Mailer: Lotus Notes Release 5.0.7 March 21, 2001 Message-ID: From: Donald_Leslie@lotus.com Date: Mon, 16 Jul 2001 11:30:59 -0400 X-MIMETrack: Serialize by Router on CAMMAIL03/CAM/M/Lotus(Release 5.0.8 |June 18, 2001) at 07/16/2001 11:31:00 AM MIME-Version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Gary andScott, I have just added an "FAQ" and a section in "Usage Patterns" with the following: If you use a character output stream to instantiate th= e StreamResult object which holds the transformation output, the Writer uses its = own encoding, not the encoding you specify in the stylesheet. If you want to use the stylesheet output encoding, do= not use StreamResult(java.io.Writer) to instantiate the holde= r for the output. Alternatively, you can specify the encoding when you create a Writer= (java.io.OutputStreamWriter). Once the Writer exists,= you cannot change its encoding. -- Don Gary L Peskin on 07/13/2001 05:21:15 PM To: Scott_Boag@lotus.com cc: bjoern.martin@gmx.net, xalan-j-users@xml.apache.org, Donald_Leslie@lotus.com Subject: Re: Reader buggy for transformation? (Was: Re: Force encoding= of resultdoc) Scott_Boag@lotus.com wrote: > > > It seems to me when you ask for a Writer output, you're asking > > for a specific encoding > > It's a little deeper than that even. We can't set the encoding of a > writer, nor can we tell what encoding it is (we only know we have a Writer, > not an OutputStreamWriter). The bottom line is, don't use Writers un= less > you have a specific reason to. Xalan has zero control over the encod= ing in > this case. Yes, I meant conceptually when you create your own Writer which you pas= s in to Xalan, you are asking for a specific encoding which, in my opinio= n should override your instructions to Xalan. Since we can't do much else, I like my interpretation of the semantic meaning of passing in your own Writer. :) > > System.setProperty("file.encoding", "UTF-8"); > > This won't do anything for Xalan, unless your method is "text" and yo= ur > result is an OutputStream. Otherwise the default is always UTF-8. No, this was meant to affect the creation of your own Writer before creating the StreamResult. I don't know why it didn't work but that is= a problem for another day. > > Now, if I > > change the output encoding to "iso-8859-1" in , the > > streams do the job and output the utf-8 '=C3=A4' as iso-8859-1 '=E4= ', but > > the FileWriter doesn't! > > If you pass in a Writer, the result is in the encoding of that Writer= . It > can not be changed. Yes. As stated above. > > > So if the FAQ entry would state that changing the encoding is only > > safe with streams set for the StreamResult, everything's fine. > > I thought the documentation did say that. Not sure about the FAQ. D= on? > > -scott I thought I saw it in the docs as well but after looking for it, I can only find it in the StreamResult(Writer) javadoc, generally considered = a write only document with respect to users :). Don, perhaps you could add something to the FAQ or a caution in the Usage Patterns. Gary > > > Bjoern Martin > lsruhe.de> cc: (bcc: Scott Boag/CAM/Lotus) > Subject: Re: Reader b= uggy for transformation? (Was: Re: Force > 07/13/01 03:10 encoding of result doc) > AM > Please respond > to bjoern.martin > > > > > Thanks, Bjoern. I looked at Cmdline.java and this was the first > > thing that jumped out at me. I'm sure I'll be able to reproduce > > it on my machine. If this is a bug, I think it is mostly a bug > > with the documentation but probably Scott and Joe should comment > > on this since I haven't really thought it through. > > Are they reading on this list? Or are we alone here? :) > > > It seems to me when you ask for a Writer output, you're asking > > for a specific encoding. The one argument constructor for > > FileWriter assumes an encoding of the java system property > > file.encoding and that's what you used. This overrides the > > encoding requested in the XSLT. > > I just added the line > > System.setProperty("file.encoding", "UTF-8"); > > in the beginning of the sample app, but nothing changed, as the line > > System.out.println(out1.getEncoding()); > > added after the file's written still returns "cp1252" :( > > > I do think this merits a FAQ entry but I wouldn't change XalanJ. > > What do you think? > > That would be sufficient, as this only occurs if you change the > encoding. Just to check I used an UTF-8 input and UTF-8 style, > creating UTF-8 output - worked fine with the streams and FileWriter, > though I still get encoding "cp1252" for the FileWriter. Now, if I > change the output encoding to "iso-8859-1" in , the > streams do the job and output the utf-8 '=C3=A4' as iso-8859-1 '=E4',= but > the FileWriter doesn't! > So if the FAQ entry would state that changing the encoding is only > safe with streams set for the StreamResult, everything's fine. > > Regards. > > -- > Bjoern Martin bjoern.martin@gmx.net =