OK. I understood this, and the โproblemโ actually occurs after the processing chain mentioned in my initial post. I will tell you in detail about what is really happening, just in case, when it helps someone else in this situation.
\' really appears as a result of how the string was written to the node.js. application Whenever a timeout occurs in the node.js application (which happens only occasionally, and as it turns out, has nothing to do with the problem \' ), I stop processing and return an error message.
For diagnostic purposes, I add a URL that has timed out to the Error object (either I create it myself or one that already exists), so that I can again access this URL to try to recreate the problem and see what could cause a timeout.
So something like:
var err = new Error('oh dear'); err.recreate = theURLString;
As it happens, when I register this err on the console (as indicated above), i.e. when \' is entered ... i.e. any character ' in theURLString is output as \' .
Therefore, I assume that this should be the implementation of the .toString() of the Error object that does this. When I do the following:
console.log(JSON.stringify(err));
... the sequence \' not displayed.
or even just the original URL string:
console.log(theURLString);
Thus, the problem (such as it was) was only at the logging stage, and not earlier. And this did not happen with every request having ' in the url, simply because not every request with ' caused a timeout (usually the problem was simply overloaded with resources). Everything that was before just threw me away.