[Mono-bugs] [Bug 23116] New - GetCharCount affects iconv internal state
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
7 Apr 2002 00:54:20 -0000
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 piersh@friskit.com.
http://bugzilla.ximian.com/show_bug.cgi?id=23116
--- shadow/23116 Sat Apr 6 19:54:20 2002
+++ shadow/23116.tmp.8614 Sat Apr 6 19:54:20 2002
@@ -0,0 +1,66 @@
+Bug#: 23116
+Product: Mono/Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: piersh@friskit.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: GetCharCount affects iconv internal state
+
+There's a bug somewhere in the iconv routines on windows. It seems that
+the 'iconv_get_length()' call is affecting whether or not the first
+character is 0xFEFF.
+
+Here's a test case:
+
+using System;
+using System.Text;
+namespace Test {
+ public class Test {
+ public static void Main () {
+ byte [] rgb = {65};
+ char [] rgch = new char [2];
+
+ Decoder decoder1 = Encoding.UTF8.GetDecoder ();
+ decoder1.GetChars (rgb, 0, 1, rgch, 0);
+ Console.WriteLine ((int) rgch[0] + " : " + rgch
+[0]);
+
+ Decoder decoder2 = Encoding.UTF8.GetDecoder ();
+ int cch = decoder2.GetCharCount (rgb, 0, 1);
+ decoder2.GetChars (rgb, 0, 1, rgch, 0);
+ Console.WriteLine ((int) rgch[0] + " : " + rgch
+[0]);
+ }
+ }
+}
+
+Under .NET the output is:
+ 65 : A
+ 65 : A
+
+Under mint (on windows) it's:
+ 65279 :
+ 65 : A
+
+The only difference is that for the second conversion, it calls
+GetCharCount first.
+
+65279 == 0xFEFF
+
+Also, it pops up an error dialog if you replace the '[2]' with '[1]', it
+says:
+ (process:3824): **ERROR**: file unicode.c: line 381
+(iconv_convert): should not be reached
+And then dies.
+
+Piers.