Closed wolfgangrittner closed 2 years ago
Thanks for the details on this. We're actually in the process of removing Webrick and switching to a Rack-based server infrastructure, so I wouldn't bother trying to patch what's there now. I'll leave this issue open though so we can double-check the new system fixes the problem.
I can't seem to repro with the new Puma/Rack server…and on Ruby 3 at least I can't even repro with Webrick either (returns a UTF-8 charset). Closing.
Bridgetown Version: 0.21.0
To Reproduce
yarn start
Current behavior
If the 404.html page contains any non-escaped special characters (example: German umlauts, like ü or ä), they are not displayed correctly. The
Content-Type
response header for the 404 response iscontent-type: text/html; charset=ISO-8859-1
.Expected behavior
Any special characters are displayed correctly, and the 404 response is served using the same content-type and encoding as any other response. In my case, and that's the default as far as I know, I'd expect
content-type: "text/html; charset=UTF-8"
.Screenshots
(instead of "zurück zur Startseite")
Computing environment (please complete the following information):
locale
in the terminal whereyarn start
was running:Additional context
I suspect the culprit is this line here: https://github.com/bridgetownrb/bridgetown/blob/main/bridgetown-core/lib/bridgetown-core/commands/serve.rb#L93 When serving the 404 response, it tries to set a
Content-Type
header (title cased), but there's already acontent-type
header (lower case) present, which seems to take precedence.I believe I've a fix for this already, would be happy to provide a PR if that's cool?