I've got an issue when testing a golang web app. In the deployed version, nginx fronts the application and explicitly sets charset utf8;
so that all textual content types are appended with a charset declaration.
In testing, I'm hitting the golang application directly, and here the content type does not have a charset set. This is causing problems when trying to serve libraries like d3 which has lines like:
var ε = 1e-6, ε2 = ε * ε, π = Math.PI, τ = 2 * π, τε = τ - ε, halfπ = π / 2, d3_radians = π / 180, d3_degrees = 180 / π;
Because golang doesn't specify the charset, these are rendered in chrome as:
var ε = 1e-6, ε2 = ε * ε....
What's the best way of getting the golang http server to output the charset=utf8 declaration on the HTTP headers?