php到rtf,é变成é [英] php to rtf, é becomes é

查看:60
本文介绍了php到rtf,é变成é的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此 rtf类,我看到我的特殊字符已经转换,例如é becomes \'C3\'A9 (那部分可能不是问题)

Using this rtf class, I see my special characters getting converted, like é becomes \'C3\'A9 (that part is probably not the problem)

一旦我在rtf中使用php标头将其获取,生成的字符(é)就会显示为é.

Once I get it in rtf using php header, the resulting character (é) is seen as é.

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中,以供参考.

Strange! My file is saved in utf-8, for information.

我在获得excel时遇到了类似的问题,但这可以通过

I had a similar problem while getting excel, but that is solved using

$text = mb_convert_encoding($text,'utf-16','utf-8');

这不适用于rtf.感谢您的帮助.

This is not working for rtf. Thanks for any help.

PS.我的文件是通过DW用utf-8编码保存的,而我的mysql默认字符集也是utf-8.当我直接从数据库中显示字符时,我没有问题,但是只有在使用标题之前直接在页面中键入特殊字符时,才会出现此问题.

PS. My file is saved with utf-8 encoding thro' DW, and my mysql default charset is also utf-8. I don't have a problem when I display a character directly from the database, but this problem is seen only when I type a special character directly into the page before to use the header.

干杯.

推荐答案

好吧,最后我使用以下方法解决了该问题:

Well, finally I solved it using:

mb_convert_encoding($text,'ISO-8859-15','utf-8');

这篇关于php到rtf,é变成é的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆