Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use htmlPurifier not to translate & into & amp in filtering input

Shulou Source: shulou.com Published: 2022-06-03 07:37:46 11月15日 Update

This article shows you how to use htmlPurifier in filtering input, do not translate & into &, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Using htmlPurifier to filter input, can you escape & into &

Today, the operation students said that some garbled codes appeared in the background title, such as & and so on. I took a look at it because the third-party package htmlpurifier was used in the project, and the initial guess is that this package has made some escapes. After searching the Internet, I didn't find it. I only found someone discussing the issue in its official forum:

Https://stackoverflow.com/questions/40463606/html-purifier-convert-amp

Http://htmlpurifier.org/phorum/read.php?3,4655

Http://htmlpurifier.org/phorum/read.php?3,7120,7120

Want to store the native & not & read the following answer: basically, this is not recommended. So I added a php function htmlspecialchars_decode in the final display to directly return &.

Add a link: HTML character entity (Character Entities), escape string (Escape Sequence)

Http://114.xixik.com/character/

On how to use htmlPurifier in the filter input do not escape & into & to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Escape input content characters more help yes no garbled interest function classmate background string official entity boy partner suggestion article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Huawei Shulou Information Shulou Tech Info NVidia