简体   繁体   中英

Python - Django remove unsafe character from string

I am currently doing a search on my website with the following character :

q=increase%0B%0B

These two characters imply an error, and my search doesn't return anything. If I only search for increase, without the two lasts, the search works. Is it a way to make it html safe by removing all the unsafe characters as those ones ?

Thanks !

I eventually found the best solution to my problem. http://chase-seibert.github.io/blog/2011/05/20/stripping-control-characters-in-python.html

It allows to have a much more generic and elegant solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM