Skip to content

Feature request: Charset by extension #110

@triska

Description

@triska

Use case: I would like to serve UTF-8 encoded *.txt files.

When I use the following server:

:- use_module(library(http/thread_httpd)).
:- use_module(library(http/http_unix_daemon)).
:- use_module(library(http/http_files)).

:- http_handler(root(.), http_reply_from_files(., []), [prefix]).

then I can fetch *.txt files. However, the content-type in responses is:

Content-Type: text/plain

whereas I would like to get responses such as:

Content-Type: text/plain; charset=UTF-8

Is there an easy way to configure the SWI infrastructure to specify charset=UTF-8 when serving *.txt files? Alternatively, would you please consider adding such a feature? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions