Re: could not determine encoding for locale "et_EE.UTF-8": codeset is "CPUTF-8" in pg_restore

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Andrus <kobruleht2(at)hot(dot)ee>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: could not determine encoding for locale "et_EE.UTF-8": codeset is "CPUTF-8" in pg_restore
Date: 2020-03-29 18:01:09
Message-ID: 2a30dc9b-79e1-69c6-3360-3cf9ac326b7e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/29/20 1:02 AM, Andrus wrote:
> Hi!
>
>> Generally speaking, locale names from Unix systems won't work at all on
>> Windows.  You need to create the database manually with whatever seems
>> to be the closest Windows locale match, and then restore its contents
>> without using --create.
>
> This is unattended script running in every night from .bat file.

Per my previous post, you might try adding something like:

cmd.exe /c chcp 1257

to the top of the batch file. This idea came from here:

https://stackoverflow.com/questions/20794035/postgresql-warning-console-code-page-437-differs-from-windows-code-page-125

>
> How to replace pg_restore --create  option with   psql and/or createdb
> calls
> and specify proper locale for them ?
>
> Currently everthing has "Estonian_Estonia.1257"  locale in windows.
> Which locale name should be specified in Windows instead of this?
> Or maybe creating new template with proper encoding or changing
> template0 encoding helps?

If I am following the error correctly then the issue is that the
Postgres console programs are using CP755 and that is not something for
which there is an automatic conversion:

https://www.postgresql.org/docs/12/multibyte.html#id-1.6.10.5.7

There is a conversion for 1257 clients so having your console run as
1257 should solve the problem. Someone with more current experience on
Windows will need to comment on whether that is the viable or best solution.

>
> Andrus.
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-03-29 18:09:39 Re: Hot standby from Debian to Windows
Previous Message Adrian Klaver 2020-03-29 17:49:17 Re: could not determine encoding for locale "et_EE.UTF-8": codeset is "CPUTF-8" in pg_restore