Recently encountered a problem, the data contains Chinese quotation marks, the results are escaped stored in the database, the data when the use of Htmlspecialchars_decode the entity escaped back, the results found not effective, looked at the Htmlspecialchars_ Decode only supports 5 specified entity conversions, others [I encountered a Chinese quotation mark &ldrquo;]
So I found out that html_entity_decode can escape all the entities back.
In addition, if you test in the browser, you will find that it is escaped back, because the browser is automatically processed. Actually did not turn back, can go to the command line to try Oh ~ ~
Html_entity_decode: Converts all HTML entities to their original characters
Contrary to Htmlentities ()
More precisely, this function decodes all entities (including all numeric entities): A) must be valid for the document type selected-that is, for XML, this function does not decode named entities that might be defined in some DTDs-and b) The character or character is in the encoded character set associated with the selected encoding and is allowed in the selected document type. All other entities remain intact.
Htmlspecialchars_decode: Converting special HTML entities back to normal characters
This function is exactly the opposite of Htmlspecialchars (). It converts special HTML entities back to normal characters.
The entities being converted are: &, "(When Ent_noquotes is not set), ' (when Ent_quotes is set), < and >.
So it is not possible to put the other conversions back that are not included in the above 5.
PHP Html_entity_decode HTML entity escape