I'm using a WPF
<WebBrowser x:Name="Browser" Loaded="Browser_OnLoaded"/>
url = @"file:///c:\A.pdf"; // This works
url = @"file:///c:\Ä.pdf"; // This shows error
To make it work with WebBrowser, you must update the encoding. By referencing the System.Web assembly you can use:
For below examples, I have used the character
All, non ASCII characters must be encoded in the URL using percent-encoded characters. It is explained in the following RFC (page 21, last paragraph of section 3.2.2): https://tools.ietf.org/html/rfc3986.
Non-ASCII characters must first be encoded according to UTF-8 [STD63], and then each octet of the corresponding UTF-8 sequence must be percent-encoded to be represented as URI characters.
So the UTF8 character corresponding to
C3 84. Which corresponds to the percent-encoded value:
You can use the following code to encode your file name: