[Mono-bugs] [Bug 75065][Nor] New - UTF8Encoding eats BOM in GetChars() where it shouldn't

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri May 27 05:49:57 EDT 2005


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 at ximian.com.

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

--- shadow/75065	2005-05-27 05:49:57.000000000 -0400
+++ shadow/75065.tmp.21739	2005-05-27 05:49:57.000000000 -0400
@@ -0,0 +1,55 @@
+Bug#: 75065
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: UTF8Encoding eats BOM in GetChars() where it shouldn't
+
+We eat BOM somewhere in UTF8Encoding.GetChars().
+
+using System;
+using System.Text;
+
+class X {
+        static void Main ()
+        {
+                Encoding e = new UTF8Encoding (false, false);
+                byte [] binary = new byte [] {0xEF, 0xBB, 0xBF, 0x1F, 0x1F};
+                char [] chars = new char [10];
+                byte [] buffer = new byte [10];
+                int n = e.GetChars (binary, 0, binary.Length, chars, 0);
+                Console.WriteLine (n);
+                for (int i = 0; i < n; i++)
+                        Console.WriteLine (chars [i]);
+        }
+}
+
+
+MS output:
+
+$ ./70471-2
+3
+?
+(0x1F)
+(0x1F)
+
+Mono output:
+
+atsushi at cfw2 ~/tests
+$ mono 70471-2.exe
+2
+(0x1F)
+(0x1F)
+
+It affects on certain kind of bugs, say #70471.


More information about the mono-bugs mailing list