0

I've been looking the answers here in this web site, but nothing have worked so far. The problem is:

In the database, strings are saved like that one: at √s = 7 TeV with.

And the reason is that the "escape" JavaScript function was used.

I was not able to "unescape" these strings in Python yet. I tried to use "eval", "decode", "re.sub" and others, but without success. So please, which function can I use to get it right?

unwind
402k64 gold badges492 silver badges620 bronze badges
asked Feb 28, 2011 at 14:44
3
  • 2
    Please specify in even more detail what you have, and what youl would expect. The quoted string you have no is hard to make sense of. Commented Feb 28, 2011 at 14:46
  • 3
    That string is not a product of the JavaScript "escape" function. If it were, there'd be no spaces in it, and the ampersand would be encoded too. Commented Feb 28, 2011 at 14:51
  • look at here stackoverflow.com/questions/628332/… Commented Feb 28, 2011 at 14:56

2 Answers 2

3

The string in question looks like it's encoded with HTML entities, in which case a routine like this one would be appropriate for unescaping. Here's how it looks for your string:

>>> print unescape('at √s = 7 TeV with')
at √s = 7 TeV with
answered Feb 28, 2011 at 14:58
Sign up to request clarification or add additional context in comments.

Comments

0

urllib.unquote should undo most if not all of the Javascript escape() function, but specific details on what you're getting out of escape() might help verify this

answered Feb 28, 2011 at 14:51

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.