<div dir="ltr">Thanks for your input. So is there anything you would recommend with respect to John's CDATACreateFunction (see thread) ?<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 28, 2017 at 4:24 PM, Yves Piguet <span dir="ltr"><<a href="mailto:yves.piguet@gmail.com" target="_blank">yves.piguet@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The single quote doesn't escape anything in JavaScript. String concatenation doesn't encode or decode anything. How Firefox and Chrome display strings in the console can be misleading (quoted stuff which looks remotely like string literal, but without escape sequences), but isn't important.<br>
<br>
Yves<br>
<br>
> On 28 Feb 2017, at 15:46, Andreas Plesch <<a href="mailto:andreasplesch@gmail.com">andreasplesch@gmail.com</a>> wrote:<br>
><br>
> A quick experiment on the firefox console:<br>
><br>
> > str = "A" + "\n" + "B";<br>
> < "A<br>
> B"<br>
> > str[0]<br>
> < "A"<br>
> > str[1]<br>
> < "<br>
> "<br>
><br>
> perhaps expected that unquoted escaped newline gets unescaped during concatenation.<br>
><br>
> Here with quoted escaped newline:<br>
><br>
> > str = "A" + "'\n'" + "B";<br>
> < "A'<br>
> 'B"<br>
> > str[1]<br>
> < "'"<br>
> > str[2]<br>
> < "<br>
> "<br>
><br>
> Perhaps unexpected that the quoted escaped newline still gets unescaped during concatenation.<br>
><br>
> So the culprit seems to be string parsing in javascript, and not necessarily DOMParser.<br>
><br>
> It therefore seems correct and necessary to escape also the back slash to prevent js parsing as you are doing now: \\n<br>
><br>
> -Andreas<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Andreas Plesch<br>39 Barbara Rd.<br>Waltham, MA 02453</div>
</div>