[Mono-bugs] [Bug 52729][Wis] Changed - Managed XSLT and encodings

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 10 Jan 2004 11:21:13 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=52729

--- shadow/52729	2004-01-09 21:27:55.000000000 -0500
+++ shadow/52729.tmp.31329	2004-01-10 11:21:13.000000000 -0500
@@ -2,15 +2,15 @@
 Product: Mono/Class Libraries
 Version: unspecified
 OS: All
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Wishlist
-Component: System.XML
+Component: System.Drawing.
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: gonzalo@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
@@ -97,6 +97,39 @@
 
 
 ------- Additional Comments From gonzalo@ximian.com  2004-01-09 20:06 -------
 Created an attachment (id=6378)
 XSLT
 
+
+------- Additional Comments From atsushi@ximian.com  2004-01-10 11:21 -------
+I cannot say my test is evident enough, but I think we cannot get 
+expected result using XslTransform.Transform (uri, argumentList, 
+outputTextWriter).
+
+This overrode of .Transform() does not use UTF-8 encoding, but uses 
+the actual TextWriter's encoding. 
+http://msdn.microsoft.com/library/default.asp?url=/library/en-
+us/cpguide/html/cpconXSLTTransformationsWithXslTransformClass.asp
+
+So if you use Console.Out for the third argument of this method, it 
+will use environment-dependent encoding (for example, it is shift_jis 
+for me, and the transformation fails because System.Text.Encoding for 
+shift_jis cannot convert that input UTF-8 string to shift_jis string. 
+I found this fact with this test code:
+
+using System;
+using System.IO;
+using System.Text;
+
+public class Test
+{
+	public static void Main ()
+	{
+		Console.WriteLine (
+			new StreamReader ("encoding.xml", 
+Encoding.UTF8).ReadToEnd ());
+	}
+}
+
+So the workaround for this is not to use Console.Out for XSLT output 
+(specifying output file argument or Stream will work).