Re-encode url from utf-8 encoded to iso-8859-1 encoded
问题 I have file:// links with non-english characters which are UrlEncoded in UTF-8. For these links to work in a browser I have to re-encode them. file://development/H%C3%A5ndplukket.doc becomes file://development/H%e5ndplukket.doc I have the following code which works: public string ReEncodeUrl(string url) { Encoding enc = Encoding.GetEncoding("iso-8859-1"); string[] parts = url.Split('/'); for (int i = 1; i < parts.Length; i++) { parts[i] = HttpUtility.UrlDecode(parts[i]); // Decode to string