Convert all HTML special chars to UTF-8 in PHP?

喜夏-厌秋 提交于 2020-01-14 10:55:03

问题


Can somebody help me? How can i convert all HTML special chars to UTF-8 Example:

Hello Word! P&H

convert to:

Hello Word! P&H

回答1:


Use html_entity_decode() and explicitly specify the charset:

$string = html_entity_decode($string, ENT_QUOTES, "utf-8");

for future reference: PHP string functions



来源:https://stackoverflow.com/questions/4775842/convert-all-html-special-chars-to-utf-8-in-php

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