I've got a question about logs encoding on Windows.
To be honest, I've tried read logs via pgAdmin what gave me an error, then tried with other tools.
At the end of the day I tried with postgresql itself:
SELECT convert_from(pg_read_binary_file('pg_log/postgresql-2012-12-07_000000.log', 0, 2000), 'UTF8');
gives error:
ERROR: invalid byte sequence for encoding "UTF8": 0xb3
then
SELECT convert_from(pg_read_binary_file('pg_log/postgresql-2012-12-07_000000.log', 0, 2000), 'WIN1250');
gives interesting output:
2012-12-07 00:00:01.869 CET|[nieznany]||[nieznany]|[nieznany]|8704 DZIENNIK: odebrano połączenie: host=myhost.mydomain.pl port=57135
2012-12-07 00:00:01.918 CET|[nieznany]|myhost.mydomain.pl|pgAgent|postgres|8704 DZIENNIK: zautoryzowano połączenie: użytkownik=pgAgent baza danych=postgres
2012-12-07 00:00:01.923 CET|[nieznany]|myhost.mydomain.pl|pgAgent|postgres|8704 DZIENNIK: wyraĹĽenie: UPDATE pgagent.pga_job SET jobagentid=2556, joblastrun=now() WHERE jobagentid IS NULL AND jobid=19
it looks like some polish diacritical letters are wrong. To give an example:
użytkownik and wyraĹĽenie (should be "wyrażenie") contain the same character "ż", but it is encoded differently. Is it a internal bug in different setting of encoding in different postgres elements?
env:
Postgres 9.2.1 64 bit on Windows Server 2008R2
client on: Windows 7 32bit
postgresql.conf settings:
log_line_prefix: %m|%a|%h|%u|%d|%p
log_statement: all
Regards,
Bartek