Equivalent to HttpUtility.UrlEncode

Nov 29, 2014 at 10:46 PM
What is the equivalent to HttpUtility.UrlEncode?

For example if I do try to encode this string: "Bearer http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=test&http%3a%2f%2fscP8c%3d"

HttpUtility.UrlEncode => Bearer+http%253a%252f%252fschemas.xmlsoap.org%252fws%252f2005%252f05%252fidentity%252fclaims%252fnameidentifier%3dtest%26http%253a%252f%252fscP8c%253d

web::uri::encode_data_string => Bearer%20http%253a%252f%252fschemas.xmlsoap.org%252fws%252f2005%252f05%252fidentity%252fclaims%252fnameidentifier%3Dtest%26http%253a%252f%252fscP8c%253d

web::uri::encode_uri => Bearer%20http%253a%252f%252fschemas.xmlsoap.org%252fws%252f2005%252f05%252fidentity%252fclaims%252fnameidentifier=test&http%253a%252f%252fscP8c%253d

Note the + and %20

Dec 4, 2014 at 11:50 PM
Hi Pedro,

Somehow this discussion slipped by my radar a bit here and went unanswered, sorry :).

Yes our encoding APIs always encode a space character as %20, which is correct according to RFC 3986. We do this instead of the older '+'. You can see more details about this on Wikipedia and stackoverflow threads.

If you absolutely have to have the '+' encoding behavior you will have to use something different.