[Mono-bugs] [Bug 70478][Maj] Changed - String.Compare("HIJ", "hij", false) gives wrong result
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 12 May 2005 22:18:17 -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 mdevine@cs.stanford.edu.
http://bugzilla.ximian.com/show_bug.cgi?id=70478
--- shadow/70478 2005-04-11 07:59:29.000000000 -0400
+++ shadow/70478.tmp.10542 2005-05-12 22:18:17.000000000 -0400
@@ -1,16 +1,16 @@
Bug#: 70478
-Product: Mono: Class Libraries
+Product: Mono: Runtime
Version: 1.1
OS: unknown
OS Details:
Status: NEW
Resolution:
Severity: Unknown
Priority: Major
-Component: CORLIB
+Component: misc
AssignedTo: atsushi@ximian.com
ReportedBy: bmaurer@users.sf.net
QAContact: mono-bugs@ximian.com
TargetMilestone: ---
URL:
Cc:
@@ -32,6 +32,33 @@
On MSFT:
C:\Inetpub\ftproot>t
1
C:\Inetpub\ftproot>
+
+------- Additional Comments From mdevine@cs.stanford.edu 2005-05-12 22:18 -------
+I hunted this down through several layers of code, until I found
+string_invariant_compare_char in mono/mono/metadata/locales.c. Here's
+an excerpt:
+
+ if (options & CompareOptions_IgnoreCase) {
+ ...
+ } else {
+ /*
+ * No options. Kana, symbol and spacing options don't
+ * apply to the invariant culture.
+ */
+
+ /*
+ * FIXME: here we must use the information from c1type and c2type
+ * to find out the proper collation, even on the InvariantCulture, the
+ * sorting is not done by computing the unicode values, but their
+ * actual sort order.
+ */
+ result = (gint32) c1 - c2;
+ }
+
+I believe that this FIXME is the source of this problem. I'm not sure
+about unicode, but in ANSI, lowercase letters are numerically lower
+than uppercase. In this code then, if we are not ignoring case while
+comparing, we simply subtract the bit patterns.