[Mono-bugs] [Bug 59720][Maj] New - CompareInfo.IndexOf() and thus String.IndexOf() fails to do case-sensitive search

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 7 Jun 2004 12:25:52 -0400 (EDT)


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

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

--- shadow/59720	2004-06-07 12:25:52.000000000 -0400
+++ shadow/59720.tmp.17871	2004-06-07 12:25:52.000000000 -0400
@@ -0,0 +1,59 @@
+Bug#: 59720
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: atsushi@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CompareInfo.IndexOf() and thus String.IndexOf() fails to do case-sensitive search
+
+When we use CompareInfo.IndexOf(), it will ignore case sensitivity.
+
+using System;
+using System.Globalization;
+
+public class Test
+{
+        public static void Main ()
+        {
+//              CompareInfo cmpi = CompareInfo.GetCompareInfo ("ja-JP");
+                CompareInfo cmpi = CompareInfo.GetCompareInfo ("en-US");
+                Console.WriteLine (cmpi.IndexOf ("A", 'a'));
+                Console.WriteLine (cmpi.IndexOf ("A", "a"));
+        }
+}
+
+Expected Results:
+$ ./indexof.exe
+-1
+-1
+
+Actual Results:
+$ mono indexof.exe
+0
+0
+
+Additional Information:
+When I add
+
+	set_collator_options (coll, options);
+
+in ves_icall_System_Globalization_CompareInfo_internal_index() and
+commented out the first ucol_setAttribute() call, IndexOf (string, string)
+got working fine. 
+
+However, as commented in that code, ignoring that setAttribute() will
+result in some incorrect result.
+
+Maybe the same thing might apply to other things like 
+ves_icall_System_String_InternalReplace_Str_Comp()
+as far as I looked into locales.c.