How to convert some multibyte characters into its numeric html entity using PHP?

半城伤御伤魂 提交于 2019-11-30 16:12:27
$encoded = mb_convert_encoding($s, 'HTML-ENTITIES', 'UTF-8'); 

asssuming your input string is UTF-8, this should encode most everything into numeric entities.

Well htmlentities doesn't work correctly. Fortunately someone has posted code on the php website that seems to do the translation of multibyte characters properly

I did work on decoding ascii into html coded text (&#xxxx). https://github.com/hellonearthis/ascii2web

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