Character entities in PHP and SVG

坚强是说给别人听的谎言 提交于 2021-02-11 13:40:41

问题


For my HTML content I have been using htmlentities($instring,ENT_QUOTES|ENT_HTML401,"UTF-8",false) to replace certain characters with HTML entities. However, I also serve SVG content, and some of the entities are not understood, such as …. Is there a special PHP function for character entities in SVG?


回答1:


Use ENT_XML1 instead of ENT_HTML401. SVG uses XML:

htmlentities($instring,ENT_QUOTES|ENT_XML1,"UTF-8",false)


来源:https://stackoverflow.com/questions/59474432/character-entities-in-php-and-svg

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