Apache 配置默认编码

找到apache配置文件 httpd.conf ,找到以下内容

#
# Specify a default charset for all content served; this enables
# interpretation of all content as UTF-8 by default.  To use the
# default browser choice (ISO-8859-1), or to allow the META tags
# in HTML content to override this choice, comment out this
# directive:
#
AddDefaultCharset UTF-8

  • 实践效果:windows下的配置文件没有这些内容,手动添加也没有效果 
  • 温馨提示:尽可能使用  脚本(如:PHP)来定义编码,代码如下:
<?php
header("Content-type: text/html; charset=utf-8");
?>
原文地址:https://www.cnblogs.com/cloudshadow/p/apache_default_code.html