简体   繁体   中英

How to set IIS website's default encoding?

My website is a combination of classic ASP and ASP.NET

My pages' default encoding is currently ISO-8859-1 .

Even if there's no <meta> tag, the response page will be encoded ISO-8859-1 .

How to change it to UTF-8 ?

The content encoding is set in the Machine.config file when the .NET Framework is installed. You can edit this file which will affect the response encoding of all ASP.NET sites, or you can override it on a per-site basis using the <globalization> element in each site's Web.config file.

MSDN Link

You could try adding the header to the HTTP Response Headers list for that site. If none is specified, it will be delivered in whatever the user agent requests, which is likely why you're seeing the ISO-8859-1

"Properties" => "HTTP Headers" => "File Types..." => "New Type...". Put in the extension you want to map, separately for each extension; IIS users will probably want to map .htm, .html,... Then, for Content type, add "text/html;charset=utf-8" (without the quotes; substitute your desired charset for utf-8;

FROM: http://www.w3.org/International/O-HTTP-charset.en.php

On Windows Server 2019 you can set "Use Unicode UTF-8 for worldwide language support". At the moment of writing it's still in beta and I can't find any official documentation. Enabling will most likely do the job.

Control Panel -> Region -> TAB: Administrative -> BUTTON: Change System Locale

You will need to reboot the server after changing this setting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM