Exactly how hard is it to encode and decode RFC2396 in ASP.net?

Yang Xing reports:

Developer [sic] should avoid encoding Space into “+” or double encoded into “%2b”. It is recommended that when encode [sic] URL use “System.Uri.EscapeDataString”, when decode URL use “HttpUtility.UrlDecode”

Sigh. There are days when one just wishes one’s back in Python-land.

Contrast with the following Python-equivalent:

>>> urllib.quote('255 m')
'255%20m'
>>> urllib.quote_plus('255 m')
'255+m'
>>> urllib.unquote('255%20m')
'255 m'
>>> urllib.unquote_plus('255%20m')
'255 m'
>>> urllib.unquote_plus('255+m')
'255 m'
Bookmark and Share

You should follow me on twitter here

Leave a Reply