From a05a04d0edb45f5c9b014eada9619141314c815f Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon, 21 Oct 2019 14:18:01 -0400
Subject: [PATCH] =?UTF-8?q?Deal=20with=20yet=20another=20issue=20related?=
 =?UTF-8?q?=20to=20"Norwegian=20(Bokm=C3=A5l)"=20locale.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It emerges that recent versions of Windows (at least 2016 Standard)
spell this locale name as "Norwegian Bokmål_Norway.1252", defeating
our mapping code that translates "Norwegian (Bokmål)_Norway" to
something that's all-ASCII (cf commits db29620d4 and aa1d2fc5e).
Add another mapping entry to handle this spelling.

Per bug #16068 from Robert Ford.  Like the previous patches,
back-patch to all supported branches.

Discussion: https://postgr.es/m/16068-4cb6eeaa7eb46d93@postgresql.org
---
 src/port/win32setlocale.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/port/win32setlocale.c b/src/port/win32setlocale.c
index 0597c2afca4..0d556800694 100644
--- a/src/port/win32setlocale.c
+++ b/src/port/win32setlocale.c
@@ -96,8 +96,12 @@ static const struct locale_map locale_map_result[] = {
 	 *
 	 * It's not clear what encoding setlocale() uses when it returns the
 	 * locale name, so to play it safe, we search for "Norwegian (Bok*l)".
+	 *
+	 * Just to make life even more complicated, some versions of Windows spell
+	 * the locale name without parentheses.  Translate that too.
 	 */
 	{"Norwegian (Bokm", "l)_Norway", "Norwegian_Norway"},
+	{"Norwegian Bokm", "l_Norway", "Norwegian_Norway"},
 	{NULL, NULL, NULL}
 };
 
-- 
GitLab