In Microsoft's ASP. NET, the default output character set is UTF-8, that is, if ASP. NETProgramWhen deploy to IIS, when accessing with a browser, you will find that the page's encoding is UTF-8. However, often we do not need UTF-8, such as mobile phone screen, the general mobile browser only supports the local character set, such as Japan's DoCoMo mobile phone only supports shift_jis encoding, so how do we convert the encoding.
The first method is to change the attributes of IIS. In IIS manager, When you select your deploy virtual directory, view its properties. In ASP. in the. NET tag, select [composition editing]. In the [application] tag of the Composition setting screen, you can set the encoding form of request and response, set the character set as needed, and then enable ASP. net screen, it is found that the output character set has changed. This is the first practice. The advantage is that it has nothing to do with the application. It is okay to configure it only on the server. The disadvantage is that you need to set the server every time you create a virtual directory.
The second method is to modify the Web. config file of the ASP. NET program. In the <system. Web> label, add the following line
< Globalization Requestencoding = "Shift_jis" Responseencoding = "Shift_jis" />
In this way, you can automatically deploy applications in the shift_jis encoding format after IIS is started. The disadvantage of this method is that it changes the application, but it cannot be considered a disadvantage. The advantage is that it does not affect the server configuration.