[Mono-bugs] [Bug 67395][Nor] New - Replacing a null char from a string removes all characters after the null char

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 3 Oct 2004 04:33:00 -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 gert.driesen@pandora.be.

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

--- shadow/67395	2004-10-03 04:33:00.000000000 -0400
+++ shadow/67395.tmp.17541	2004-10-03 04:33:00.000000000 -0400
@@ -0,0 +1,51 @@
+Bug#: 67395
+Product: Mono: Runtime
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gert.driesen@pandora.be               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Replacing a null char from a string removes all characters after the null char
+
+When using String.Replace to replace a null character with a certain
+string, all characters starting from the null char are actually removed
+from the string.
+
+To reproduce this issue :
+
+1. compile the following source :
+
+using System;
+
+public class EntryPoint {
+  public static int Main () {
+    string message = "is \0 ok ?";
+    string result = message.Replace("\0", "this");
+    if (result != "is this ok ?") {
+      Console.WriteLine ("Replace did not return expected result.");
+      Console.WriteLine ("Expected: is this ok ?");
+      Console.WriteLine ("Actual: " + result);
+      return 1;
+    }
+    return 0;
+  }
+}
+
+2. Execute the built assembly (eg. mono test.exe)
+
+On Mono (both Windows as Linux), you'll get the following output :
+
+Replace did not return expected result.
+Expected: is this ok ?
+Actual: is
+
+This works fine on MS.NET.