My question is: How can I get OpenBSD's httpd to serve a particular
file, or all files of a particular extension, as the case may be, with
the following HTTP header?

Content-type: text/plain; charset=utf-8

I have written a simple "hello-world" PHP script which creates a table
and inserts some data into the PostgreSQL database, queries the
database, and displays the results.

https://amarillo.colmena.biz/~justina/contacto.php

There is a link at the bottom of that page "ver la fuente" to view the
source, which appears to be served properly by php-fpm, since PHP
allows one to specify HTTP headers verbatim. I have also copied the
exact same script to 

https://amarillo.colmena.biz/~justina/contacto.txt

but this file is not served with the correct character set encoding to
view properly in a web browser. In particular I have initialized the
database with the locale "es_MX.UTF-8" which was available on my
OpenBSD system.  My script names one of the columns in the database
table with the literal Spanish word "método", containing the utf-8
character "é" which is outside the 7-bit US-ASCII set.

In /etc/httpd.conf, I have the following section.

types {
        include "/usr/share/misc/mime.types"
}

In /usr/share/misc/mime.types,

There is the line

text/plain      txt

but there does not seem to be a way to specify the correct character set
in the HTTP header from OpenBSD's httpd. What am I missing here?

Reply via email to