Re: PostgreSQL 12 installation fails because locale name contained non-english characters - Mailing list pgsql-bugs

From Skjalg A. Skagen
Subject Re: PostgreSQL 12 installation fails because locale name contained non-english characters
Date
Msg-id 0JMgntHjNV6lvZjE4mr6cd1bxhxPSdp0Upve8WYY2djchvBvfzrxyB8tVtWaq1pw85A4reFxU0rpjxUZrd3U2_K6YTI1LQj4ZEXWQUyG-mY=@pm.me
Whole thread Raw
In response to Re: PostgreSQL 12 installation fails because locale name contained non-english characters  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PostgreSQL 12 installation fails because locale name contained non-english characters
List pgsql-bugs
Hi Tom,

If you mean what I see in the drop-down menu during installation, I see "Norwegian Bokmål, Norway" -- identical to what
getlocales.exereported in my installation log file on line 222: 

NorwegianxxSPxxBokmålxxCOMMAxxxxSPxxNorway=Norwegian Bokmål, Norway

After installation with the default locale, PgAdmin 4 was giving me encoding errors when it tried to select data from
pg_database,so I followed all the steps in this wiki article:
https://wiki.postgresql.org/wiki/Changes_To_Norwegian_Locale#What_do_I_need_to_do.3F

However, I had to modify the UPDATE query and remove all the parentheses from the query given by the wiki article, like
this:

UPDATE pg_database
SET datcollate = 'Norwegian_Norway' || substr(datcollate, position('.' in datcollate))
WHERE datcollate LIKE 'Norwegian Bokm%' OR datcollate LIKE 'norwegian-bokmal%';

UPDATE pg_database
SET datctype = 'Norwegian_Norway' || substr(datctype, position('.' in datctype))
WHERE datctype LIKE 'Norwegian Bokm%' OR datctype LIKE 'norwegian-bokmal%';

Likewise, lc_messages, lc_monetary, lc_numeric, lc_time in my unmodified postgresql.conf file had no parentheses
either,like the wiki article said they should have had: 

...
# These settings are initialized by initdb, but they can be changed.
lc_messages = 'Norwegian Bokmål_Norway.1252'            # locale for system error message
                    # strings
lc_monetary = 'Norwegian Bokmål_Norway.1252'            # locale for monetary formatting
lc_numeric = 'Norwegian Bokmål_Norway.1252'             # locale for number formatting
lc_time = 'Norwegian Bokmål_Norway.1252'                # locale for time formatting

The unmodified datcollate and datctypes in pg_database, right after installation with default locale, were as follows:

Query:

SELECT encode(datcollate::bytea, 'escape') as datcollate, encode(datctype::bytea, 'escape') as datctype
FROM pg_database;

Result:

datcollate    datctype
Norwegian Bokm\345l_Norway.1252    Norwegian Bokm\345l_Norway.1252
Norwegian Bokm\345l_Norway.1252    Norwegian Bokm\345l_Norway.1252
Norwegian Bokm\345l_Norway.1252    Norwegian Bokm\345l_Norway.1252
Norwegian Bokm\345l_Norway.1252    Norwegian Bokm\345l_Norway.1252

I hope this will be helpful.

Best regards,
Skjalg


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, November 5, 2019 6:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Bruce Momjian bruce@momjian.us writes:
>
> > On Thu, Oct 24, 2019 at 11:06:01AM +0000, Skjalg A. Skagen wrote:
> >
> > > I tried to install PostgreSQL 12 with the "Norwegian Bokmål, Norway" locale in
> > > hope that it would, among other things, provide proper support for Norwegian
> > > characters out-of-the-box.
> > > But initcluster.vbs appear to fail during post-install because the locale name
> > > contains a Norwegian character that is being mishandled (full log in attached
> > > zip file):
> > > initdb: error: invalid locale name "NorwegianBokm†l,Norway"
>
> > This has been fixed with the this patch:
> > https://www.postgresql.org/message-id/E1iMcHC-0007Ci-7G@gemulon.postgresql.org
>
> Hm, I'm not entirely sure that it has been. The original code supposed
> that the locale name is spelled "Norwegian (Bokmål)_Norway", and the
> recent patch you mention extended that to allow "Norwegian Bokmål_Norway".
> But this report, if accurate, shows yet another variant. Skjalg,
> would you confirm that there's a comma and space before "Norway" in
> the locale name as you see it? (Your log clearly shows it with a
> space in the registry entries, but it looks like initdb might be
> seeing it as not having any spaces, which is why I'm confused.)
>
> I wonder whether we need to relax the matching code to be entirely
> agnostic about spaces and punctuation in the Windows locale name.
>
> regards, tom lane





pgsql-bugs by date:

Previous
From: Andrey Lepikhov
Date:
Subject: Re: The XLogFindNextRecord() routine find incorrect record startpoint after a long continuation record
Next
From: PG Bug reporting form
Date:
Subject: BUG #16096: psql (non-interactive mode) SQL multi-request commands don't report all feedback ?!