0

In my windows form, i have a webbrowser control used as "file explorer".

I use webbrowser.url.localpath to get the actual path of selected folder.

I want to decode url because special characters return bad(ex : %C9 instead of É)

The function webutility.urldecode doesn't works for me !!!

Dim string1 As String = WebUtility.UrlDecode(WebBrowser1.Url.LocalPath)
'return : \\path\D�g�ts des eaux instead of \\path\Dégâts des eaux

Help me please !!!!

thks

  • `WebUtility.UrlEncode('É')` should be `%C3%89`. The converted string is expected to conform to the UTF-8 format. Your `%C9` is wrong, corresponds to an 8-bit encoding e.g. `cp1252` or `cp1250` or `cp1257` etc. – JosefZ Jun 15 '23 at 17:54
  • OK. But do you Know how to decode this format ? – Jimmy Dubray Jun 16 '23 at 11:23
  • Please [edit] your question to improve your [mcve]. In particular, share a piece of code where you get `%C9` from `É`. Instead, generally: **1st** switch to [UTF-8 Everywhere](https://utf8everywhere.org/), incl. [Beta: Use Unicode UTF-8 for worldwide language support](https://stackoverflow.com/questions/56419639/). **2nd** (unwise, I know…) `python -c "import sys;from urllib.parse import unquote;print( unquote(sys.argv[1], encoding='cp1252'))" "%C9cole D%E9g%E2ts des eaux"` returns `École Dégâts des eaux`… – JosefZ Jun 16 '23 at 15:21

0 Answers0