【发布时间】:2011-08-07 00:28:41
【问题描述】:
使用这个rtf class,我看到我的特殊字符被转换了,比如é becomes \'C3\'A9(那部分可能不是问题)
一旦我使用 php 标头在 rtf 中获取它,生成的字符 (é) 将被视为 é。
header("Content-type: application/rtf; charset=utf-8");
header("Content-Disposition: attachment; filename=$file_rtf");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
奇怪!我的文件以 utf-8 格式保存,以供参考。
我在获取 excel 时遇到了类似的问题,但使用
解决了$text = mb_convert_encoding($text,'utf-16','utf-8');
这不适用于 rtf。感谢您的帮助。
PS。我的文件是用 utf-8 编码 thro' DW 保存的,我的 mysql 默认字符集也是 utf-8。我直接从数据库中显示一个字符是没有问题的,但是这个问题只有在我之前直接在页面中输入一个特殊字符来使用页眉时才会出现。
干杯。
【问题讨论】:
标签: php unicode utf-8 special-characters rtf