Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set UTF-8 charset on directory listing in HTTP::StaticFileHandler #14546

Merged
merged 2 commits into from
May 13, 2024

Conversation

alexkutsan
Copy link
Contributor

@alexkutsan alexkutsan commented Apr 28, 2024

Within the directory listing handler, the absence of an explicit charset in the content type has led to issues, particularly with directories containing non-ASCII symbols, resulting in broken displays.

Adding charset charset=UTF-8 to the Content-type header fixes this issue.

Alternative solution is to add to https://github.com/crystal-lang/crystal/blob/master/src/http/server/handlers/static_file_handler.html

Within the directory listing handler, the absence of an explicit charset in the content type has led to issues, particularly with directories containing non-ASCII symbols, resulting in broken displays.

Adding charset charset=UTF-8 to the Content-type header fixes this issue.
@Blacksmoke16 Blacksmoke16 added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking labels Apr 28, 2024
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
@beta-ziliani beta-ziliani added this to the 1.13.0 milestone May 10, 2024
@straight-shoota straight-shoota changed the title HTTP::StaticFileHandler: Add UTF-8 Charset to the response Content type for directory_listing Set UTF-8 charset on directory listing in HTTP::StaticFileHandler May 13, 2024
@straight-shoota straight-shoota merged commit 262e3af into crystal-lang:master May 13, 2024
60 checks passed
@alexkutsan alexkutsan deleted the patch-1 branch July 10, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants