Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

Commented Unassigned: uri decode issue [97]

$
0
0
Hello,
I am using the latest 2.0.0 version and I believe uri::decode is not behaving as expected. For example the code

```
utility::string_t text = web::uri::decode(L"J'ai+besoin+de+trouver+un+personnage+%C3%A9trange");
```

I expect to return "J'ai besoin de trouver un personnage étrange" and not "J'ai+besoin+de+trouver+un+personnage+étrange".

Is this the expected behavior or a bug?

Thanks,
Pedro
Comments: Hi Pedro, What you are describing is the expected behavior. Encoding spaces as the '+' character is non-standard, the correct way is to use %20. When decoding we have no way of knowing whether or not the '+' character means a space or actually just the plus character. Our implementation follows the [RFC 3986](http://tools.ietf.org/html/rfc3986). Here is a [question on stackoverflow](http://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20) about it, and the [Wikipedia article](http://en.wikipedia.org/wiki/Percent-encoding) mentioning it. Perhaps we could consider having an extra function for people who know that the '+' character should be decoded into spaces. Something like ::web::uri::decode_plus? Steve

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>