Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQ5VA-009Smq-0L for pgsql-admin@arkaria.postgresql.org; Mon, 01 Dec 2025 15:07:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vQ5V7-003KJ8-0Q for pgsql-admin@arkaria.postgresql.org; Mon, 01 Dec 2025 15:07:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vQ5V6-003KIx-2T for pgsql-admin@lists.postgresql.org; Mon, 01 Dec 2025 15:07:41 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vQ5V0-002aiR-2v for pgsql-admin@lists.postgresql.org; Mon, 01 Dec 2025 15:07:36 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-b736cd741c1so665809166b.0 for ; Mon, 01 Dec 2025 07:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1764601653; x=1765206453; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=nAyxKBMPHhhKancQ2WG6Lqd9v7HOieQ3iyCr13Lnhus=; b=Cn87jDunTFYSbaUCpJVJt+gUsjO+stLG+Ku3Bqw1rJhiXYh0RYdOyC6ORVLIVeJ/Di 1upS3k3jCD8SDZ+GRnicIDn4HKWtQBau1UMc0VrC3X5YlKKrQ6NZ7oswn7XPFWN5l27J M9jKDCo8pOTInfOKdFEKMdC/cgy8nWW6DvJlezCdPF4jurpsKJAcpzE3bElmi/YgbzT3 BE9ivBDcMFhw7+DLmBHCCQGgd3WSoMnJAME/1JhNOU8gPXOPDVyGubDhi+23xmP1YXLo tJudSs4/q58+yMfYONOS0WYaVpKZ9bJgf/O4MWZ0A5wUL9PE9Wn0vxFZsmwi4Zp8hCc3 0TSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764601653; x=1765206453; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nAyxKBMPHhhKancQ2WG6Lqd9v7HOieQ3iyCr13Lnhus=; b=pP9HHakmhLy43JHDXtw4rUFNiITO26zt7NdiyPMJ1svpySzsTjUumiHNnniM3fPSlL H9BN7Az1PKRhwHs/Fxec4dQ2N+mQIyZDEMXu7B5/PwgkaTbPKgDN/yoW75bbx68F7yZi 5SjGZ80BocBm8H5ROKZd+oRFvYyQs9uhJNLLQgJbUdQKJwwtmi2IA28vEGZ/R8X46K4j xRDy5mFmYDesNexR7pEm8Wik0cjYF7XYe6tAq5SXIe9l7BbzrNZD36CJTsGwS9YqzFzG Rxce2aYR+YIDU0GjQFFUcnd4iFDhJdvBpOchf6PuDh1oWiPGt1uw/muk2o1WoZHbqjdt +lyA== X-Forwarded-Encrypted: i=1; AJvYcCVIvrLr7LHrPXsEEVlWZlllr6yWCsmKy285Ruj9cf6OtHQiN6urduGegTaDW8FFyTQwZoZ3fRnJ3xKUww==@lists.postgresql.org X-Gm-Message-State: AOJu0Yx9pxnNPHIIPO03f23QDzOONqTHp5wYexsUyrpZuwA/6mF3KlDg NVmbU3GLnUsK0JR9b3/o9XoTCj+B2Mp5LnqahiNvbsexaXi3CglAraCR4wJsIHm2Ytqjze36L/m S+mpw3amaHw== X-Gm-Gg: ASbGncuedM5puig2bzduMdwQECbs+7zU2xrtKDJoIPU4JPHlk7m8kbeb20qjH5g9HBj VFPOuVOVPF7z0AgJ517MbmuyCdy+zoX1XriPu93wIQ9CDHdJDkeR7GD3HHmrG7T9iUeYtfnWsMz 6wxX1eDDNkztiiEvkSaOCUMVTGvKhYgSMKwJ9+XNaitIWlg9TMl8bvtJ1QCsMuDHjgKoJUcArPe 2IUZZJblv+eLfPHgZIsl3L+dP2SZDXNMjoyeSiNoe55wS3CEOf41wv5EvUabr/I/JW/FPoUlDkR wWESRz1rPKwLcR5egpYsNxIzO89fNiWq3FGBcxDIwqtMks+azGagymKFqS7Uf7gpcHi1CRyklwZ UA1vS4mI2uKJnrJ3ugHUDL2rDl/rolJV+1pbvZcYnJPQU9q4vebHgFnuFJcg4x0K9m4Lga68W9+ YxoXe6u6wLVcwc15AKt/ysc0kuakuSfwUh05HpCZzU X-Google-Smtp-Source: AGHT+IFfe3zO3h6GNhSqNVt2GiW5k4krOIapBkB3wGb6c421JUBNCOPBnJIsWdhaO9iCKTht0brsEQ== X-Received: by 2002:a17:907:9491:b0:b73:43ee:a262 with SMTP id a640c23a62f3a-b7671743721mr4353286466b.51.1764601651080; Mon, 01 Dec 2025 07:07:31 -0800 (PST) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:4da6:f0e:8e32:27ad:b088]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b76f59a6a74sm1248460366b.45.2025.12.01.07.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Dec 2025 07:07:30 -0800 (PST) Message-ID: Subject: Re: Importing a Windows database (in en_GB.CP1252) to linux From: Laurenz Albe To: Jean-Christophe BOGGIO , "pgsql-admin@lists.postgresql.org" Date: Mon, 01 Dec 2025 16:07:30 +0100 In-Reply-To: <5d7b5d51-a7c7-4cf2-943c-49b93441b8fa@thefreecat.org> References: <5d7b5d51-a7c7-4cf2-943c-49b93441b8fa@thefreecat.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2025-12-01 at 14:37 +0100, Jean-Christophe BOGGIO wrote: > I have a (custom) backup created on a Windows machine in en_GB.CP1252 enc= oding. > And of course, some characters can't be imported because they don't exist= in UTF-8. Hm? Which character can be encoded in WINDOWS-1252, but not in UTF-8? I don't think that can be the problem. > So I created a new cluster on PG18 port 5433 initialized in WIN1252 encod= ing: >=20 > $ \l imlocal=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0List of databases=20 > =C2=A0=C2=A0Name =C2=A0=C2=A0| Owner | Encoding | Locale Provider | Colla= te | Ctype | Locale | ICU Rules | Access privileges =C2=A0 > ---------+-------+----------+-----------------+---------+-------+--------= +-----------+-------------------=20 > =C2=A0imlocal | cat =C2=A0=C2=A0| WIN1252 =C2=A0| libc =C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| C =C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0| C =C2=A0=C2=A0=C2=A0=C2=A0| =E2=88=85 =C2=A0=C2=A0=C2=A0| = =E2=88=85 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| =E2=88=85=20 > =C2=A0(1 row) >=20 > =C2=A0=C2=A0I am now trying to import the data in that database but I kee= p getting this error: >=20 > $ pg_restore -p 5433 -t csakafl -d imlocal imlocal20251127.backup=20 > =C2=A0pg_restore: error: COPY failed for table "csakafl": ERROR: =C2=A0in= valid byte sequence for encoding "UTF8": 0x92=20 > =C2=A0CONTEXT: =C2=A0COPY csakafl, line 298 >=20 > =C2=A0So pg_restore still thinks I want to use UTF8. That looks like pg_restore sets a wrong client_encoding, which is weird. What do you get for pg_restore -p 5433 -t csakafl -s -f - imlocal20251127.backup | grep clien= t_encoding If the dump was taken from a WINDOWS-1252 encoded database, that line shoul= d read SET client_encoding =3D 'WIN1252'; and everything should work fine. But apparently, the client_encoding is se= t to UTF-8 in your case. How did that happen? How exactly did you take that dump? Did you do anything (like an encoding conversion) with the dump after you t= ook it? Yours, Laurenz Albe