0

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?

posfan12
  • 2,541
  • 8
  • 35
  • 57

1 Answers1

1

Use ENT_XML1 instead of ENT_HTML401. SVG uses XML:

htmlentities($instring,ENT_QUOTES|ENT_XML1,"UTF-8",false)
Anonymous
  • 11,748
  • 6
  • 35
  • 57