I'm building a query for YQL, and I've ran into a dumb issue. I wont be pasting in the entire query as there is no need, just the part I'm having the issue with:
var query = encodeURI("... and xpath='//div[@class=\\'body bodySign\\']/p' ...")';
As you may notice, I've added two \
characters, it is need for the actual query. I'm using multi queries, and I need to double esacpe the '
character in order for them to parse correctly inside YQL.
But JavaScript escapes the \
character. It doesn't matter how many \
I add (to "escape" to following \
character) I still get left with only one \
in my query.
How do I keep multiple \
characters without them escaping each other?
Thanks
It should be
var query = encodeURI("... and xpath='//div[@class=\\\\'body bodySign\\\\']/p' ...")';
For example, hit F12 and look at the output of console.log("\\\\")
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With