HttpUtility.UrlEncode standard encoding vs specified encoding?

What would the difference be between:

HttpUtility.UrlEncode("some string with é and β and stuff")
HttpUtility.UrlEncode("some string with é and β and stuff", Encoding.UTF8)
HttpUtility.UrlEncode( "some string with é and β and stuff", Encoding.Default )

result being:

some+string+with+%c3%a9+and+%ce%b2+and+stuff
some+string+with+%c3%a9+and+%ce%b2+and+stuff
some+string+with+%e9+and+%df+and+stuff

When testing, I get the same result for the first two, so can i safely assume that UTF8 is the default unless specified, or can that differ on different systems?

I have seene examples of unicode escape sequences that looks like this:

%u00e9 (é)

Fairly certain that paypal sends that in their IPN-requests. Why doesn't .NET encode like that?

6
задан jishi 13 December 2010 в 13:32
поделиться