如何防止显示菱形问号符号,即使使用 mb_substr 和 utf-8 [英] How to prevent showing the diamond question mark symbol, even using mb_substr and utf-8
本文介绍了如何防止显示菱形问号符号,即使使用 mb_substr 和 utf-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经阅读了一些其他问题,尝试了答案,但最终没有结果.我得到的是例如这个
Μήπως θα έπρεπε να ...
而且我无法删除那个奇怪的问号.我所做的是获取 RSS 提要的内容,该内容也被编码为<?xml version="1.0" encoding="UTF-8"?>
使用希腊语作为内容.
有什么办法可以解决这个问题吗?
<div><?php$entry->description = strip_tags($entry->description);echo mb_substr($entry->description, 0, 490);?>...
解决方案
这就是答案
mb_substr($entry->description, 0, 490, "UTF-8");
I have read some other questions, tried the answers but got no result at the end. What I get is for example this
Μήπως θα έπρεπε να � ...
and I can't remove that weird question mark. What I do is to get the content of an RSS feed that is encoded also to
<?xml version="1.0" encoding="UTF-8"?>
using Greek language for the content.
Is there any way to fix this?
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div><?php
$entry->description = strip_tags($entry->description);
echo mb_substr($entry->description, 0, 490);
?> ...</div>
解决方案
This is the answer
mb_substr($entry->description, 0, 490, "UTF-8");
这篇关于如何防止显示菱形问号符号,即使使用 mb_substr 和 utf-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文