Forum Moderators: open
Basically I am pulling a large string from a database for example:
"This is my string I am getting from the database
It also contains new line characters"
So when I assign this string to a JavaScript variable I get a syntax error because the JavaScript variables do not allow for new line characters.
Any Ideas?
Thanks,
Ryan
See the list of (other) escape sequences [javascriptkit.com].
If you are in Perl you can easily fix this with a couple of regex's...
## To remove UNIX/MAC newline charaters...
s/\r//g;## To change linebreaks into actual linebreak escapes...
s/\n/\\n/g;
You could also use this for other escape characters.