- Package:
- postgresql-autodoc
- Source:
- postgresql-autodoc
- Submitter:
- Thorsten Glaser
- Date:
- 2017-11-13 17:36:07 UTC
- Severity:
- important
/usr/share/postgresql_autodoc/html.tmpl specifies the HTML encoding twice: once, near the top, as UTF-8 (correct) and once, near the bottom of the <head/>, as latin1 (incorrect). Please remove the second instance and ensure postgresql_autodoc always produces correct UTF-8.
This has just now started to produce bogus input, namely when
nōn-ASCII chars are used in the database. For just umlauts:
~$ sudo su - postgres
$ createdb -E UTF-8 -O postgres -T template0 -l de_DE.UTF-8 tstdb
$ export LC_ALL=C.UTF-8
$ psql tstdb
psql (10.0)
Type "help" for help.
tstdb=# CREATE FUNCTION tst() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN
tstdb$# RAISE EXCEPTION 'mäh';
tstdb$# END; $$;
CREATE FUNCTION
tstdb=# \q
$ postgresql_autodoc -d tstdb -f foo -t html
Producing foo.html from /usr/share/postgresql_autodoc/html.tmpl
$ fgrep -a -e \<meta -e RAISE foo.html
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
RAISE EXCEPTION 'm�h';
$ fgrep -a -e \<meta -e RAISE /usr/share/postgresql_autodoc/html.tmpl
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
When using Unicode characters beyond latin1, things get inconsistent:
$ psql tstdb
psql (10.0)
Type "help" for help.
tstdb=# CREATE FUNCTION tst2() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN
RAISE EXCEPTION 'm€h';
END; $$;
CREATE FUNCTION
tstdb=# \q
$ postgresql_autodoc -d tstdb -f foo -t html
Producing foo.html from /usr/share/postgresql_autodoc/html.tmpl
Wide character in print at /usr/bin/postgresql_autodoc line 1616.
$ fgrep -a -e \<meta -e RAISE foo.html
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
RAISE EXCEPTION 'mäh';
RAISE EXCEPTION 'm€h';