0

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 !

5
  • Why is that parameter being generated in the first place? Commented Dec 9, 2014 at 16:00
  • Because a malicious user entered it. Commented Dec 9, 2014 at 16:10
  • Sounds to me then that ignoring it is the correct thing to do. Commented Dec 9, 2014 at 16:15
  • 'increase%0B%0B'.replace('%0B', '') => 'increase' (captain obvious) Commented Dec 10, 2014 at 9:40
  • import re re.sub('%..', '', 'increase%0B%0B') => 'increase' Commented Dec 10, 2014 at 9:52

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.