Server-side Python tool for escaping script tags and converting characters into HTML entity equivalents (no regex).
Install with pip:
pip install back-cleaner
This function escapes script tags with backslashes.
from back_cleaner.cleaner import escape_script_tags
source = "<script>Hey, how are you doing?</script>"
result = escape_script_tags(source)
print(result)
This function converts the following characters into the HTML entity equivalents.
- Ampersand (&)
- Less than (<)
- Greater than (>)
- Double quote (")
- Single quote (')
from back_cleaner.cleaner import replace_with_ents
source = "<script>Hey, how are you doing?</script>"
result = replace_with_ents(source)
print(result)