d3 / d3-plugins

[DEPRECATED] A repository for sharing D3.js V3 plugins.

Home Page:https://github.com/d3/d3/wiki/Plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rho character in interpolate-zoom.js causes parse error in Chrome when using SimpleHTTPServer

eagereyes opened this issue · comments

It seems that Chrome doesn't like unicode characters when it loads files from a server that doesn't provide the right MIME type (like python -mSimpleHTTPServer). Changing the rho character to a p fixes it. I know it's not very elegant, but for a lot of testing stuff, I use SimpleHTTPServer, and this would help to not run into that sort of issue.

Either or both of the following should also work:

  • Use <meta charset="utf-8">.
  • Use <script charset="utf-8" src="…">.

Yep, what Jason said. My typical HTML preamble is:

<!DOCTYPE html>
<meta charset="utf-8">

The third option available to you is to minify the code, which in the process mangles symbols and converts them to ascii characters. For example, with UglifyJS:

uglifyjs interpolate-zoom.js -c -m -o interpolate-zoom.min.js

Alright, the charset attribute in the script tag works. Thanks!