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,405
  • 36
  • 126
  • 226

2 Answers2

1

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

Dims
  • 47,675
  • 117
  • 331
  • 600
0
Uri.UnescapeDataString(HttpUtility.UrlDecode("ły"));

done the trick

Tony
  • 12,405
  • 36
  • 126
  • 226