[Mono-dev] UrlEncode difference in dotnet and mono
Andrew Skiba
andrews at mainsoft.com
Wed Dec 21 09:46:19 EST 2005
Hi Gonzalo,
I found that UrlEncode behaves differently in dotnet and Mono, namely
Mono encodes the asterisk (*) symbol into %2a.
The following code prints different values, for example:
public static void Main ()
{
Console.Out.WriteLine
(System.Web.HttpUtility.UrlEncode("aaa*bbb"));
}
A naive fix might be like this, but may be there are similar problems
with other characters. What do you think?
Index: HttpUtility.cs
===================================================================
--- HttpUtility.cs (revision 54691)
+++ HttpUtility.cs (working copy)
@@ -650,7 +650,7 @@
int end = offset + count;
for (int i = offset; i < end; i++) {
char c = (char) bytes [i];
- if ((c == ' ') || (c < '0' && c != '-'
&& c != '.') ||
+ if ((c == ' ') || (c < '0' && c != '-'
&& c != '.' && c != '*') ||
(c < 'A' && c > '9') ||
(c > 'Z' && c < 'a' && c != '_') ||
(c > 'z')) {
More information about the Mono-devel-list
mailing list