Results 1 to 2 of 2
Thread: Newlines in function arguments
Feb 22, 2008, 08:55 #1
- Join Date
- Nov 2005
- 0 Post(s)
- 0 Thread(s)
Newlines in function arguments
First of all, I tried this:
commentsR = comments.replace(new RegExp( "\\n", "g" ), "\\r");
Which does seem to place \r where expected, but the string call still fails with "unterminated string constant" and using the MS debugger and copying and pasting the string into a textpad reveals there are still line break characters in the string - I have no idea what these are or how to find and replace them.
I tried using encodeURI which seemed to do the trick but when the string was passed back with decodeURI I found that as well as preserving the newlines, it had added a normal space character after each newline.
Anyone help me out with what to do here?
Feb 22, 2008, 12:55 #2
- Join Date
- Jan 2007
- Christchurch, New Zealand
- 83 Post(s)
- 4 Thread(s)
Can you please post the function call that's giving the "unterminated string constant" and also a sample of the troublesome string, perhaps after you've run the escape() function over that string?
It doesn't appear to be a newline problem, but more of an issue with opening and closing quotes.