“unescaped xml character” in Javascript in IDE

My IDE is throwing a red “unescaped xml character” error on lots of my JS after a recent update.

I had a suspicion that the old cdata tag might solve this.

Sure enough. It turns out that this is a problem for javascript that appears inline rather than being kept in a separate file.

Solve it by adding this additional protective code inside the script tags:

<script type="text/javascript">
//<![CDATA[
...code...
//]]>
</script>

Full treatment here.

Leave a Reply