【问题标题】:Character encoding issue with accent带重音的字符编码问题
【发布时间】:2013-06-19 19:12:02
【问题描述】:

我对 php 页面有一个奇怪的问题。 这是 php

<?
    $fp = fopen('encoding.txt', 'a+');
    fwrite($fp, "côté");
    fclose($fp);
?>

当我尝试使用浏览器 http://local.host/encoding.txt 查看 txt 文件时,结果是:

côté

当我编辑源代码时,结果是:

côté

但是当我通过 filezilla 下载文件并使用 textedit 编辑它时,结果是:

côté

我错过了什么?

我已经尝试过(没有改变任何东西):

$fp = fopen('encoding.txt', 'a+');
fwrite($fp, utf8_encode("côté"));
fclose($fp);

感谢您的帮助

【问题讨论】:

  • 您需要在浏览器中为该特定页面设置正确的编码(法语)才能正常查看

标签: php encoding non-ascii-characters


【解决方案1】:

确保文件保存为 UTF-8 并且浏览器使用 UTF-8 编码。 也许这就够了。

【讨论】:

    猜你喜欢
    • 2011-09-26
    • 1970-01-01
    • 2011-06-10
    • 1970-01-01
    • 2018-09-13
    • 2021-07-07
    • 1970-01-01
    • 2015-08-23
    • 1970-01-01
    相关资源
    最近更新 更多