pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Igniris Valdivia Baez <igniris@gmail.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: how can I fix my accent issues?
Date: Tue, 12 Dec 2023 15:14:05 -0800
Message-ID: <763a967a-6ac9-45ed-bdf2-fd9385ee8f35@aklaver.com> (raw)
In-Reply-To: <CAD_aniGsGDfMJ+jOW7R2AHCVWy6a14mbS_FdYJyOarOx_g2rFA@mail.gmail.com>
References: <CAD_aniHBxNsTFjJO+dSaifQwtf2dEX2FKezOaic5KgJ_NCGNTw@mail.gmail.com>
	<b9060d08c552156f4bd3ddad3e6248d7124b9553.camel@cybertec.at>
	<CAD_aniGsGDfMJ+jOW7R2AHCVWy6a14mbS_FdYJyOarOx_g2rFA@mail.gmail.com>

On 12/11/23 10:54, Igniris Valdivia Baez wrote:
> hello to all, thanks for your answers i've changed the encoding using this:
> ALTER DATABASE testdb
> SET client_encoding = WIN1252;
> 
> now when we try to select data from a table we get this error:
> 
> ERROR: character with byte sequence 0xe2 0x80 0x8b in encoding "UTF8"
> has no equivalent in encoding "WIN1252" SQL state: 22P05ERROR:
> character with byte sequence 0xe2 0x80 0x8b in encoding "UTF8" has no
> equivalent in encoding "WIN1252" SQL state: 22P05
> 
> i want to clarify that the postgres on dev is in a docker environment
> that already have databases in it so we can't change encoding for the
> hole container

You don't have to:

https://www.postgresql.org/docs/current/manage-ag-templatedbs.html

Another common reason for copying template0 instead of template1 is that 
new encoding and locale settings can be specified when copying 
template0, whereas a copy of template1 must use the same settings it 
does. This is because template1 might contain encoding-specific or 
locale-specific data, while template0 is known not to.

> 
> thanks in advance
> 
> El sáb, 9 dic 2023 a las 1:01, Laurenz Albe
> (<laurenz.albe@cybertec.at>) escribió:
>>
>> On Fri, 2023-12-08 at 23:58 -0500, Igniris Valdivia Baez wrote:
>>> hello, I have an ETL process collecting data from a postgresql
>>> database and xls files and inserting in a postgresql database that
>>> process occurs great in a local DB in postgres 14 with UTF8
>>> codification and Spanish_Cuba.1952 collation but when I execute that
>>> process in dev which is in postgres 15 and UTF8 with collation
>>> en_US.utf8 the words with accents and ñ looks like an interrogation
>>> symbol, what can I do to fix this?
>>
>> If the data you are sending are encoded in WINDOWS-1252 (I assume that
>> "1952" is just a typo), you should set the client encoding to WIN1252,
>> so that PostgreSQL knows how to convert the data correctly.
>>
>> You can do that in several ways; the simplest might be to set the
>> environment variable PGCLIENTENCODING to WIN1252.
>>
>> Yours,
>> Laurenz Albe
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (21+ messages)  latest in thread

Message-ID: <763a967a-6ac9-45ed-bdf2-fd9385ee8f35@aklaver.com>
Permalink:  ../763a967a-6ac9-45ed-bdf2-fd9385ee8f35@aklaver.com/
Also on:    postgresql.org/message-id/763a967a-6ac9-45ed-bdf2-fd9385ee8f35@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, igniris@gmail.com, laurenz.albe@cybertec.at
  Subject: Re: how can I fix my accent issues?
  In-Reply-To: <763a967a-6ac9-45ed-bdf2-fd9385ee8f35@aklaver.com>
  References: <CAD_aniHBxNsTFjJO+dSaifQwtf2dEX2FKezOaic5KgJ_NCGNTw@mail.gmail.com> <b9060d08c552156f4bd3ddad3e6248d7124b9553.camel@cybertec.at> <CAD_aniGsGDfMJ+jOW7R2AHCVWy6a14mbS_FdYJyOarOx_g2rFA@mail.gmail.com> <763a967a-6ac9-45ed-bdf2-fd9385ee8f35@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox