[Mono-dev] [PATCH] System.Uri.EscapeString ()
stephane at delcroix.org
Tue Feb 26 11:26:10 EST 2008
the System.Uri ctor is sometimes wrong for utf8 strings that need
encoding, as shown is the following code snippet:
public class Test
public static void Main()
string ok = "file:///tmp/x (%232).jpg";
string nok = "file:///tmp/ü (%232).jpg";
Console.WriteLine (new Uri (ok).ToString ());
Console.WriteLine (new Uri (nok).ToString ());
which is wrong.
The culprit being the (internal) EscapeString which iterates on a byte but check (and then replace)
for IsHexEncoding on the String itself. For multibyte encodings (like utf8) the index can be out of sync.
I attached a patch, please review.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2141 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080226/775f304b/attachment.bin
More information about the Mono-devel-list