php to rtf, é becomes é

我怕爱的太早我们不能终老 提交于 2019-12-03 16:12:49

Well, finally I solved it using:

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

You’re getting double-encoded. A \N{LATIN SMALL LETTER E WITH ACUTE} character is code point U+00E9. In UTF-8, that is \xC3\xA9.

But if you turn around and treat those two bytes as distinct code points U+00C3 and U+00A9, those are \N{LATIN CAPITAL LETTER A WITH TILDE} and \N{COPYRIGHT SIGN}, respectively.

Now once those now in turn get re-encoded, you get the byte sequence \xC3\x83\xC2\xA9, which is what you are seeing.

Are you on Windows system? They often seem to double-re-encode things.

You should ask author of the script, but judging from documentation and provided encodings, it is not UTF8 friendly. So you may try converting text to your code page (ex. cp1251) and using one of available encodings in this class to find best results.

hmm, having the same problem pulling from mysql. My page is encoded in UTF-8, as is my database. I'm even forcing mysqli into utf-8 mode by putting

if (!$mysqli->set_charset("utf8")) {echo "utf8 on";} else {echo "utf8 already on";}; 

nothing helps, i keep getting é

this was my solution, not eloquent, but it works.

echo str_replace('é', 'é', $mySQLResult);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!