mozilla / bleach

Bleach is an allowed-list-based HTML sanitizing library that escapes or strips markup and attributes
https://bleach.readthedocs.io/en/latest/
Other
2.65k stars 253 forks source link

bug: bleach.clean is not handling & symbol very well #681

Closed aurangzaib048 closed 1 year ago

aurangzaib048 commented 1 year ago

Describe the bug

bleach.clean is change the & symbol to & which is not good. There good be some flag/parameters to ignore char/sym/words.

python and bleach versions (please complete the following information):

To Reproduce

Steps to reproduce the behavior:

[e.g. ```python

bleach.clean("Food & Wine") "Food & Wine"

Expected behavior

[e.g. ```python

bleach.clean("Food & Wine") "Food & Wine"

Additional context

Add any other context about the problem here.

willkg commented 1 year ago

You don't explain why this behavior is bad or how it affects you, so it's hard to speak to your specific use case. This seems just like issue #192. Bleach sanitizes text for html output and converts bare & to the character entity.