Tomas Tomas - 1 year ago 168
C# Question

Url Unicode characters encoding

How to encode URLs containing Unicode? I would like to pass it to a command line utility and I need to encode it first.



Answer Source

You can use the HttpUtility.UrlPathEncode method in the System.Web assembly (requires the full .NET Framework 4 profile):

var encoded = HttpUtility.UrlPathEncode("白雜訊");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download