D3.js: "Uncaught SyntaxError: Unexpected token ILLEGAL"?

Solution 1:

Try specifying the UTF-8 charset on the HTML host document :

<meta http-equiv="content-type" content="text/html; charset=UTF8">

D3 contains UTF-8 symbols (like π) invalids in non-UTF8 documents.

Solution 2:

That sounds like a problem with encoding. I recommend The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!). Despite the somewhat condescending title, it contains some very useful information. Specifically, it sounds like your server is serving the d3.v3.js file with the wrong encoding.

Solution 3:

Add 'charset="utf-8"'

<script src="/d3.v3.js" charset="utf-8"></script>