12

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?

Scott 混合理论
  • 2,263
  • 8
  • 34
  • 59

3 Answers3

7

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

Krisztián Balla
  • 19,223
  • 13
  • 68
  • 84
PraveenVenu
  • 8,217
  • 4
  • 30
  • 39
6

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

FlavorScape
  • 13,301
  • 12
  • 75
  • 117
0

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.

Mark
  • 343
  • 3
  • 11