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 1n8Gpt-00039t-Lp for pgsql-admin@arkaria.postgresql.org; Fri, 14 Jan 2022 07:17:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n8Gpr-0007Mi-UC for pgsql-admin@arkaria.postgresql.org; Fri, 14 Jan 2022 07:17:19 +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 1n8Gpr-0007MY-JI for pgsql-admin@lists.postgresql.org; Fri, 14 Jan 2022 07:17:19 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n8Gpo-00040i-P8 for pgsql-admin@lists.postgresql.org; Fri, 14 Jan 2022 07:17:19 +0000 Received: by mail-wr1-x42c.google.com with SMTP id a5so14053788wrh.5 for ; Thu, 13 Jan 2022 23:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=VG3fCwn391EOEGF90M9kl3X0PpzR0jJRFz6WddjgFJc=; b=QYsnJgH1jMrOwc2JR6DpL4It8XIWwW8gwcVcF1hGVYcL+ihpbbLMk5x57H4hRSCrpT rPBQGSlSiyB0CQDtpzwTv1eqqG0qpsADRbIznDfl2xkipPuYwS6VDMCnnkUz/bj3mbHO IWG2j8vpJGOjHlhjkc/LoUXR+qq83Rja4senGS9M4RcUvM6DsxtExmM+wtuBds6w1sVi IzrfWnjorAZSaUz0hWwLTvSuGWCnGEHcTt5HkZf0X0PM4uvMdTX4hFHTcPqRNJCp2oQE k21kQFmyZr4+yUORRj0Fgy5w9ZfgPHWDrPe3g2xGKwDCughJpb/WLGcqacuX35EmSh8+ 0H2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=VG3fCwn391EOEGF90M9kl3X0PpzR0jJRFz6WddjgFJc=; b=WoNYhR69PdzmxLK5TqGI/L9h2iAln/Wk76g1TAMq1drqopzMv2OAQhhGBLYQvyVC9X Yc5P94ODAzwagAWqz047RiLSgVWlf8/6D7p378UpTwZlweEnV6H6W9HNdmwTj3aKpoKk ZD0ysGTKs3xPUIZDlvzFNP2RNGex6uuvadmuqgKMu2zrCP3I3NVv7Fxr2mRlSrdDtNBB p7kDodZC4Y0dYQakAgtz4Qge7jkQlCIa/Iflq7rOx+mg40UerrIC1LeQ3Lr8qKW/Bay/ DOI08za9ybJvrXlqPgmv/lZE2NrOiJkF9PtB8iGre8sZoFBqIL8acgVKTJNN2wxI876E F8aQ== X-Gm-Message-State: AOAM531NHY5FCW4vOdMg6SnwEGcq0JevqvZcXNLBgguz3+O8BgawuwE9 HMMptKD+bY8DBZyoqlib66l2rjVSjbd8hg== X-Google-Smtp-Source: ABdhPJyL5WsitrleB8QqVFx3nriNJG5a/ExZWf+wQeESVX8B5flHGNXOw+9mgGNk35DO8iFj5BvQ4w== X-Received: by 2002:adf:ef8d:: with SMTP id d13mr7084738wro.556.1642144635746; Thu, 13 Jan 2022 23:17:15 -0800 (PST) Received: from localhost.localdomain (mobiledyn-62-240-134-162.mrsn.at. [62.240.134.162]) by smtp.gmail.com with ESMTPSA id m1sm6788248wrp.81.2022.01.13.23.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jan 2022 23:17:15 -0800 (PST) Message-ID: Subject: Re: database encoding and collation. From: Laurenz Albe To: "James Pang (chaolpan)" , "pgsql-admin@lists.postgresql.org" Date: Fri, 14 Jan 2022 08:17:14 +0100 In-Reply-To: References: <68331b01ee5ed0d02158747bf0e2d2e4476cbbb8.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-2.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2022-01-14 at 02:11 +0000, 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 ? I see the problem: the sloppy checking of Oracle allowed you to insert corrupted strings into the Oracle database by setting client encoding equal to server encoding, and you might not detect the problem until you try to read the data with a different client encoding. You may be able to carry on like this in PostgreSQL, since all bytes are valid LATIN1 code points, but (like in Oracle) you will run into problems as soon as you access the database with a different client encoding, for example with a JDBC driver. It would be better to fix the problem. If all the data in the database are actually encoded in a certain encoding (different from ISO-8859-1), you could simply import them into a database with that encoding, and you would have the benefit of having correct data. If different strings are encoded in different encodings, then you would have to repair the data before doing that. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com