pandeiro / boot-http

A simple HTTP serve task for the Boot build tool
62 stars 34 forks source link

Not serving JavaScript files with UTF-8 encoding correctly #55

Closed shen-tian closed 7 years ago

shen-tian commented 7 years ago

Not sure if it's boot-http issue or one of its dependencies, but it's not serving JavaScript files with non-ASCII chars correctly. When it tries to do so, with the required <meta charset="UTF-8"> in the HTML, it yields a Uncaught SyntaxError: Invalid or unexpected token error.

I've reproduced the issues here. Trivial example, using an untouched copy of plotly.js (which uses the greek letters for pi and epsilon as variable names) and a minimal HTML file. It servers correctly with Python's SimpleHTTPServer but not boot-http.

Seems it's similar to this issue with figwheel? I've had a look through the source, but couldn't determine where the issue is.

I came across this while working on a ClojureScript page using cljsjs/plotly.

pandeiro commented 7 years ago

Thanks, @shen-tian. As discussed in Slack, it looks like a Jetty configuration issue. The instant workaround is using httpkit, which seems to default to serving content as UTF-8. I'll look into whether Jetty can be configured by boot-http to default to that charset, as well.

kommen commented 7 years ago

Ran into the same issue with plotlyjs, this PR fixes the issue for me: https://github.com/pandeiro/boot-http/pull/62

pandeiro commented 7 years ago

Fixed in 0.8.2