[Mono-bugs] [Bug 78352][Wis] New - System.Text.Encoding.UTF8 does not treat character 0xfeff (65279) The same way as Microsoft .Net

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 9 19:59:59 EDT 2006


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 scott at imeem.com.

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

--- shadow/78352	2006-05-09 19:59:59.000000000 -0400
+++ shadow/78352.tmp.11597	2006-05-09 19:59:59.000000000 -0400
@@ -0,0 +1,54 @@
+Bug#: 78352
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: scott at imeem.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Text.Encoding.UTF8 does not treat character 0xfeff (65279) The same way as Microsoft .Net
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The UTF8 code for charater 65279 is a 3 byte code, the windows libraries
+decode the byte combination to the correct single character. 
+The Mono implementation will decode this to an empty string
+
+
+Steps to reproduce the problem:
+
+byte[] stringBytes = new byte[3];
+// 3 byte chars....
+i = 65279;
+stringBytes[0] = (byte) (((i >> 12) & 0x0f) | 0xe0);
+stringBytes[1] = (byte) (((i >> 6) & 0x3f) | 0x80);
+stringBytes[2] = (byte) ((i & 0x3f) | 0x80);
+
+string decoded = System.Text.Encoding.UTF8.GetString(stringBytes);
+Console.WriteLine(decoded.Length);
+
+
+Actual Results:
+0 
+(empty string on mono)
+
+Expected Results:
+1
+(1 character string on Messy windows)
+
+How often does this happen? 
+if you pick a random character? 1 in 2^16
+
+Additional Information:
+Character 65279 is a special byte ordering marker, it may have special
+meaning at the start of the string, so it's entirely possible that windows
+is doing the wrong thing here.


More information about the mono-bugs mailing list