Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8CQ8-0002mv-WD for pgsql-admin@arkaria.postgresql.org; Fri, 14 Jan 2022 02:34:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n8CQ7-0008JC-Rr for pgsql-admin@arkaria.postgresql.org; Fri, 14 Jan 2022 02:34:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8CQ7-0008J3-EY for pgsql-admin@lists.postgresql.org; Fri, 14 Jan 2022 02:34:27 +0000 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n8CQ4-0001hT-K4 for pgsql-admin@lists.postgresql.org; Fri, 14 Jan 2022 02:34:27 +0000 Received: by mail-ot1-x332.google.com with SMTP id s21-20020a05683004d500b0058f585672efso8633240otd.3 for ; Thu, 13 Jan 2022 18:34:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=IgxZe48Z4Xc0qIWJqptkoSjnpP+8nL0bjDbMo6ay0JY=; b=bTU0TrJ4vVOrJC0sbHdL9Tn83fltH4QIOk/JdLBhjHKsSdvb/LxoBE/kk609SpjOcC 7vOztNDQ1U1KKOTZIvX7hwpM5wTgDlmUexjYLzZ9m25lNX3gOJDfqa62cO19uj0CPWgb /AuTG39pjgrohlUKc6wxhdgmXJkkka7y+gJAWk1j9zSY3pxMrBTriRU8yNkIT45C2EeM b5664wy5RUygErpy3D2S0Mp2COkUEGUrbEOsdL+DeuptezL1/BEC9u26/qtFtwvp8DDG SBpMi5v0NlWprJAqDrB3bNgbrRf115SK8TsCSHhLZzdqoz2zZTrSxuaUj6kLFVhew4zi QyhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=IgxZe48Z4Xc0qIWJqptkoSjnpP+8nL0bjDbMo6ay0JY=; b=7N1N3OYmHgyC1CheaJ0g7w7tZNBFovvJAr0izAQ1m5807LK2lHhQplsBDnus0JncOc udPz1I4DtbOOGsFKA4UjxPZvXub18gwIPJlsu/5gybSj356SmH9uN+Tcn2AgpIqPTHt5 pGYnewjn4yXpXYYUqxAHcGNvb+Wlad8V5cIctMZ4cx4AQiwYR2t0ZxN7A84u9Bxr6Co6 OotQSurGbXA52+mMBqL04Kkth8hZ10pdbl2iyF3K9E1ny6mDYhq44wlv1x0UiXjIZxEf gwz8hq6dXLAkNIRGXptF9HUxm2OTSC/YPuxWqaMLlDqWRZ17Bfxqa9Fx2qNfTLrycJ3u l5Fg== X-Gm-Message-State: AOAM533P82ZT3iaBEm7posumOBPwlXyOvTncnl6+WGHFyFhpB0c2OsW1 qjlPVqB12WvhY5h5/6jr3hR8pCqlXn8= X-Google-Smtp-Source: ABdhPJxKYOyp4gTZ0zHWcHDRW/62uDVbPVMMIK3oR8MDzwqjHGqhtWyey9jhqEVzEkm+LaPLqgfBPQ== X-Received: by 2002:a9d:ea6:: with SMTP id 35mr5249317otj.304.1642127662311; Thu, 13 Jan 2022 18:34:22 -0800 (PST) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id c26sm1137684otr.65.2022.01.13.18.34.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jan 2022 18:34:21 -0800 (PST) Subject: Re: database encoding and collation. To: pgsql-admin@lists.postgresql.org References: <68331b01ee5ed0d02158747bf0e2d2e4476cbbb8.camel@cybertec.at> From: Ron Message-ID: <2ebc9c27-fd0e-2f8f-eee0-534277fb2e89@gmail.com> Date: Thu, 13 Jan 2022 20:34:21 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------502215ADD729E8EE80366BC3" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------502215ADD729E8EE80366BC3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit *Try* UTF-8 in a little test application, and *see what happens*. On 1/13/22 8:11 PM, James Pang (chaolpan) wrote: > This question is about how to handle multiple languages in database , English, Japanese ,Chinese... The Oracle database used WE8ISO8859P1 from long time ago , when put "Chinese" letters in database, client application just use WE8ISO8859P1 (client encoding) to insert data into database , so no conversion there. When client app query the data , it still get the data with WE8ISO8859P1 , and then convert that data to UTF8 from client app side. Now, we plan migrate to Postgresql 13, want Postgresql database use WE8ISO8859P1 same as Oracle too, and same handling as Oracle. > Any potential risk ? > > Thanks, > > James > -----Original Message----- > From: Laurenz Albe > Sent: Friday, January 14, 2022 3:20 AM > To: James Pang (chaolpan) ; pgsql-admin@lists.postgresql.org > Subject: Re: database encoding and collation. > > On Wed, 2022-01-12 at 13:31 +0000, James Pang (chaolpan) wrote: >> We plan to migrate from Oracle to Postgresql 13, existing Oracle >> database charaterset WE8ISO8859P1 , NLS_SORT = BINARY, NLS_COM=BINARY. >> we want to keep same encoding and collation in Postgresql 13 as Oracle, so encoding=LATIN1 (Aliases ISO88591), what’s the suggested collation and ctype? Using ‘C’,’POSIX’, or en_US.LATIN1 ? >> if using en_US.LATIN1 any impact to indexes and query where like % ? >> The OS is Redhat 8, when export NLS_LANG=en_US.LATIN1, LC_COLLATE and >> LC_CTYPE automatically set to en_US.LATIN1, and then initdb create database clusters with  collname, collation, ctype all = en_US.LATIN1. > I advise against using any encoding other than UTF-8. > What are you worried about? > > For the locale, you can get the same behavior as in Oracle by using "C" or "POSIX" > (they are the same). > > Yours, > Laurenz Albe > -- > Cybertec | https://www.cybertec-postgresql.com > -- Angular momentum makes the world go 'round. --------------502215ADD729E8EE80366BC3 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Try UTF-8 in a little test application, and see what happens.

On 1/13/22 8:11 PM, James Pang (chaolpan) wrote:
    This question is about how to handle multiple languages in database , English, Japanese ,Chinese...  The Oracle database used WE8ISO8859P1 from long time ago , when put "Chinese" letters in database, client application just use  WE8ISO8859P1 (client encoding) to insert data into database , so no conversion there. When client app query the data , it still get the data with WE8ISO8859P1 , and then convert that data to UTF8 from client app side.   Now, we plan migrate to Postgresql 13,  want Postgresql database use WE8ISO8859P1 same as Oracle too, and same handling as Oracle. 
   Any potential risk ?

Thanks,

James
-----Original Message-----
From: Laurenz Albe <laurenz.albe@cybertec.at> 
Sent: Friday, January 14, 2022 3:20 AM
To: James Pang (chaolpan) <chaolpan@cisco.com>; pgsql-admin@lists.postgresql.org
Subject: Re: database encoding and collation.

On Wed, 2022-01-12 at 13:31 +0000, James Pang (chaolpan) wrote:
We plan to migrate from Oracle to Postgresql 13, existing Oracle 
database charaterset WE8ISO8859P1 , NLS_SORT = BINARY, NLS_COM=BINARY. 
we want to keep same encoding and collation in Postgresql 13 as Oracle, so encoding=LATIN1 (Aliases ISO88591), what’s the suggested collation and ctype? Using ‘C’,’POSIX’, or en_US.LATIN1 ?
if using en_US.LATIN1 any impact to indexes and query where like % ?
The OS is Redhat 8, when export NLS_LANG=en_US.LATIN1, LC_COLLATE and 
LC_CTYPE automatically set to en_US.LATIN1, and then initdb create database clusters with  collname, collation, ctype all = en_US.LATIN1.
I advise against using any encoding other than UTF-8.
What are you worried about?

For the locale, you can get the same behavior as in Oracle by using "C" or "POSIX"
(they are the same).

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com


--
Angular momentum makes the world go 'round.
--------------502215ADD729E8EE80366BC3--