How to force UTF-8 encoding in browser?(如何在浏览器中强制使用 UTF-8 编码?)
问题描述
我有用
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
但是当我进入页面时,在浏览器中选择了另一种编码 (ISO).我尝试通过 PHP 方法设置编码
But when I enter the page another encoding (ISO) is chosen in browser. I have tried to set encoding by PHP method
header('Content-type: text/html; charset=utf-8');
但这也没有帮助.所有源文件都以 UTF-8 编码,没有 BOM.我尝试过的唯一解决方案是通过添加 AddDefaultCharset UTF-8
行在 .htaccess
文件中设置编码,但是服务器上的另一个页面没有正确显示.我该如何解决这个问题?
But it also didn't help. All source files are encoded in UTF-8 without BOM. The only solution which I tried and it had worked was setting encoding in .htaccess
file by adding AddDefaultCharset UTF-8
line, but then another pages on the server were not displayed correctly. How can I solve this problem?
推荐答案
禁用默认字符集:
AddDefaultCharset Off
这篇关于如何在浏览器中强制使用 UTF-8 编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在浏览器中强制使用 UTF-8 编码?


- PHP foreach() 与数组中的数组? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01