Solve the problem that c# Chinese characters are displayed garbled on the web page


HttpUtility.UrlEncode(this.TextBox1.Text.ToString());


HttpUtility.UrlEncode 方法

.NET Framework (current version)
 

Encode the URL string.  These method overloads can be used to encode the entire URL, including the value of the query string.

To encode or decode values ​​outside the web application, use the  WebUtility  class.

Namespace:     System.Web
Assembly:   System.Web (in System.Web.dll)

  name illustrate
System_CAPS_pubmethodSystem_CAPS_static UrlEncode(Byte[])

Convert a byte array to an encoded URL string.

System_CAPS_pubmethodSystem_CAPS_static UrlEncode(Byte[], Int32, Int32)

Converts an array of bytes to a URL-encoded string, starting at the specified position in the array, with the specified number of bytes.

System_CAPS_pubmethodSystem_CAPS_static UrlEncode(String)

Encode the URL string.

System_CAPS_pubmethodSystem_CAPS_static UrlEncode(String, Encoding)

Encodes the URL string using the specified encoding object.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324842703&siteId=291194637