1

on my page I have set the UTF-8 encoding. Then, I send a string "ły" encoded by encodeURIComponent() function to %C5%82y and on the server side, I get %25C5%2582y. And now I want to have back the original string.

I've tried:

HttpUtility.HtmlDecode(): the result is %25C5%2582y
Uri.UnescapeDataString(): the result is %C5%82y

I'm confused now - how to retrieve back the original string ?

Tony
  • 12,023
  • 33
  • 123
  • 218

2 Answers2

1

Use HttpUtility.UrlEncode to encode and HttpUtility.UrlDecode to decode.

Dims
  • 42,427
  • 94
  • 291
  • 543
0
Uri.UnescapeDataString(HttpUtility.UrlDecode("ły"));

done the trick

Tony
  • 12,023
  • 33
  • 123
  • 218