[Mono-bugs] [Bug 56985][Wis] Changed - Error in String.Replace()

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 15 Apr 2004 13:45:39 -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 mono-bug@jerryweb.info.

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

--- shadow/56985	2004-04-15 13:23:44.000000000 -0400
+++ shadow/56985.tmp.28758	2004-04-15 13:45:39.000000000 -0400
@@ -1,13 +1,13 @@
 Bug#: 56985
 Product: Mono: Class Libraries
 Version: unspecified
 OS: unknown
 OS Details: 
-Status: RESOLVED   
-Resolution: NOTABUG
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Wishlist
 Component: CORLIB
 AssignedTo: dick@ximian.com                            
 ReportedBy: mono-bug@jerryweb.info               
 QAContact: mono-bugs@ximian.com
@@ -96,6 +96,82 @@
 (int) s2[0] = 160
 s1.Replace(s2, "abc"):  ;
 s2.Replace(s1, "def"):  ;
 s1.Equals(s2): False
 
 It is compatible?
+
+------- Additional Comments From mono-bug@jerryweb.info  2004-04-15 13:45 -------
+OK. See the following test:
+
+=================================================
+using System;
+using System.Globalization;
+using System.Threading;
+using System.Xml;
+
+namespace Test {
+   class TestClass {
+      static void Main() {
+         char ch1 = (char) 32;
+         char ch2 = (char) 160;
+         string s1 = new string(ch1, 1);
+         string s2 = new string(ch2, 1);
+
+         Console.WriteLine("(int) s1[0] = {0}", (int) s1[0]);
+         Console.WriteLine("(int) s2[0] = {0}", (int) s2[0]);
+
+         Thread.CurrentThread.CurrentCulture = new CultureInfo("");
+         Console.WriteLine("Invariant culture");
+         string s3 = s1.Replace(s2, "abc");
+         Console.WriteLine("s1.Replace(s2, \"abc\"): {0};", s3);
+         s3 = s2.Replace(s1, "def");
+         Console.WriteLine("s2.Replace(s1, \"def\"): {0};", s3);
+         Console.WriteLine("s1 == s2: {0}", s1 == s2);
+         Console.WriteLine("s1.Equals(s2): {0}", s1.Equals(s2));
+         Console.WriteLine();
+
+         Thread.CurrentThread.CurrentCulture = new CultureInfo("cs-CZ");
+         Console.WriteLine("Czech culture");
+         s3 = s1.Replace(s2, "abc");
+         Console.WriteLine("s1.Replace(s2, \"abc\"): {0};", s3);
+         s3 = s2.Replace(s1, "def");
+         Console.WriteLine("s2.Replace(s1, \"def\"): {0};", s3);
+         Console.WriteLine("s1 == s2: {0}", s1 == s2);
+         Console.WriteLine("s1.Equals(s2): {0}", s1.Equals(s2));
+
+      }
+   }
+}
+=================================================
+
+Actual results:
+
+Gentoo Linux:
+(int) s1[0] = 32
+(int) s2[0] = 160
+Invariant culture
+s1.Replace(s2, "abc"):  ;
+s2.Replace(s1, "def"):  ;
+s1 == s2: False
+s1.Equals(s2): False
+
+Czech culture
+s1.Replace(s2, "abc"): abc;
+s2.Replace(s1, "def"): def;
+s1 == s2: False
+s1.Equals(s2): False
+
+MS .NET 1.0:
+(int) s1[0] = 32
+(int) s2[0] = 160
+Invariant culture
+s1.Replace(s2, "abc"):  ;
+s2.Replace(s1, "def"):  ;
+s1 == s2: False
+s1.Equals(s2): False
+
+Czech culture
+s1.Replace(s2, "abc"):  ;
+s2.Replace(s1, "def"):  ;
+s1 == s2: False
+s1.Equals(s2): False