[Mono-bugs] [Bug 76722][Cri] New - When convert string to byte
array encoded in GB2312 or GB18030, the result is not correct
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Nov 16 04:47:04 EST 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 zhushisongzhu at yahoo.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76722
--- shadow/76722 2005-11-16 04:47:04.000000000 -0500
+++ shadow/76722.tmp.21710 2005-11-16 04:47:04.000000000 -0500
@@ -0,0 +1,58 @@
+Bug#: 76722
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Critical
+Component: CORLIB
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: zhushisongzhu at yahoo.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: When convert string to byte array encoded in GB2312 or GB18030, the result is not correct
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. GBK encoding
+ String s = "12\u7f51\u9875";
+
+ Encoding e = Encoding.GetEncoding("GBK");
+ byte[] bytebuf = e.GetBytes(s);
+
+ for ( int i =0; i< bytebuf.Length ; i++)
+ Console.Write("{0:X2}",(byte)bytebuf[i]);
+
+2. GB18030 Encoding
+ String s = "12\u7f51\u9875";
+
+ Encoding e = Encoding.GetEncoding("GB18030");
+ byte[] bytebuf = e.GetBytes(s);
+
+ for ( int i =0; i< bytebuf.Length ; i++)
+ Console.Write("{0:X2}",(byte)bytebuf[i]);
+
+Actual Results:
+case 1:
+ 00310032CDF8D2B3
+case 2:
+ 31328230833582359131
+
+Expected Results:
+case 1:
+ 3132CDF8D2B3
+case 2:
+ 3132CDF8D2B3
+
+How often does this happen?
+ always
+
+Additional Information:
More information about the mono-bugs
mailing list