[Mono-bugs] [Bug 53841][Cri] New - GB2312 encoding BUG
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 3 Feb 2004 21:41:51 -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 shiziye@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=53841
--- shadow/53841 2004-02-03 21:41:51.000000000 -0500
+++ shadow/53841.tmp.5125 2004-02-03 21:41:51.000000000 -0500
@@ -0,0 +1,58 @@
+Bug#: 53841
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Critical
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: shiziye@hotmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: GB2312 encoding BUG
+
+I have posted this BUG with earlier mono version before.
+Because Mono 0.30 include new ICU library, and I found BUG still exist. So
+I post it here again.
+I wrote this program:
+
+using System;
+using System.Text;
+using System.IO;
+
+
+public class MyApp
+{
+ public static void OutBytes(byte[] b, string name)
+ {
+ Console.WriteLine("Output bytes " + name);
+ for (int i = 0; i < b.Length; i++)
+ Console.WriteLine(" " + name + "[{0}] = {1:X}", i,
+b[i]);
+ }
+
+
+ public static void Main()
+ {
+ Encoding e = Encoding.GetEncoding("gb2312");
+ byte[] b = new byte[] {0xC4, 0xE3, 0xBA, 0xC3};
+
+
+ string str = e.GetString(b);
+ byte[] b2 = e.GetBytes(str);
+
+ OutBytes(b, "b");
+ OutBytes(b2, "b2");
+ }
+}
+
+Bytes b is two chinese word in gb2312 encoding.
+The output of b and b2 should be the same.
+But it is not.
+I don't now which process is wrong, gb2312 to unicode or unicode to gb2312.
+It's a critical problem prevent chinese from using Mono.