Opened 5 years ago
Closed 5 years ago
#30635 closed New feature (needsinfo)
Add feature to sanitize text include control characters
Reported by: | Tatsuya Matoba | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Current, If Django send to feed text with control characters, Django raise the UnserializableContentError
.
It was added by #20197.
I think a common solution for app developers who encounter this problem would be to sanitize the control characters.
I think it is desirable Django provide sanitizing feature for control characters.
For example, add the following function to django/utils/xmlutils.py
:
def sanitize_control_charcters(text): return re.sub(r'[\x00-\x08\x0B-\x0C\x0E-\x1F]', " ", text)
If there is no problem with adding functions, I would like to send a PR.
Change History (1)
comment:1 by , 5 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Version: | 2.2 → master |
Note:
See TracTickets
for help on using tickets.
I'm not sure a util in Django is really called for here. (The thought is: Process your data prior to handing it off for serialization.)
Maybe we could include something but...
I'll mark this Needs Info. Maybe a fuller suggestion presented to the DevelopersMailingList might be a way forward.