We were seeing browsers interpret UTF-8 output as Windows-1252 and freaking right out.
The fix was as simple as calling settings.add_charset << 'application/hal+json' (we're using HAL). I think you could easily fix this with the registered callback in the Sinatra::Yaks module. Will send a PR
Sinatra, by default, only adds
charset
toContent-Type
if there isn't an entry insettings.add_charset
(see https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L1840 and https://github.com/sinatra/sinatra/blob/master/lib/sinatra/base.rb#L325-L327.We were seeing browsers interpret UTF-8 output as Windows-1252 and freaking right out.
The fix was as simple as calling
settings.add_charset << 'application/hal+json'
(we're using HAL). I think you could easily fix this with theregistered
callback in theSinatra::Yaks
module. Will send a PR