Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 7DD071AB353B for ; Wed, 18 Jul 2012 12:05:28 -0300 (ADT) Received: from mail-lb0-f174.google.com ([209.85.217.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SrVoX-0007v5-KF for pgsql-general@postgresql.org; Wed, 18 Jul 2012 15:05:27 +0000 Received: by lbbgm6 with SMTP id gm6so2208048lbb.19 for ; Wed, 18 Jul 2012 08:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=EbuAHNFNAt0HJ5y9eRsMsfvSFH1J8iDakw9b1zulfwU=; b=dbbFHw3dcAA8H/MWPpdPW7Eanx8REe/vRCEMtcZaf7u3GFK4n3GqMQMHdcAqE6vab5 szFcD9v55Fz5Dcmyh93u8pBcJUgoXxjLEfqwCoFeEu61Alf9Hm29/ZyjFiDy7NGdeZoM soO2uy6vdQ/X4r2XnoS0nwRJfFEUbz7RumnX2KZZG11sXfVkUpjh5NLphW1Ce/kvpaIO F4oL75t3rzsYqnzwxPK97Jrb391/NuwzHA10dXzJaO8b+fzFh5uNTCiPSS8TmQk11llp 8Qlp+gEDe3/mYKkf8Iul6pysMy0yVunX6olEWuJ65jEYDdug38+7khcWUPls4PBJg5e2 nrGw== Received: by 10.112.85.39 with SMTP id e7mr1977900lbz.56.1342623908322; Wed, 18 Jul 2012 08:05:08 -0700 (PDT) Received: from [1.0.0.7] ([94.138.26.200]) by mx.google.com with ESMTPS id fy10sm22056429lab.0.2012.07.18.08.05.05 (version=SSLv3 cipher=OTHER); Wed, 18 Jul 2012 08:05:07 -0700 (PDT) Message-ID: <5006D0A3.5040309@gmail.com> Date: Wed, 18 Jul 2012 19:05:07 +0400 From: Alexander Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: pgsql-general@postgresql.org, ringerc@ringerc.id.au CC: yi.codeplayer@gmail.com Subject: Re: BUG #6742: pg_dump doesn't convert encoding of DB object names to OS encoding References: <1331925178-sup-9261@alvh.no-ip.org> <4F65A533.7090208@gmail.com> <1332187409-sup-4631@alvh.no-ip.org> <50067916.8010508@gmail.com> In-Reply-To: <50067916.8010508@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201207/325 X-Sequence-Number: 188836 Hello! May I to propose a solution and to step up? I've read a discussion of the bug #5800 and here is my 2 cents. To make things clear let me give an example. I am a PostgreSQL hosting provider and I let my customers to create any databases they wish. I have clients all over the world (so they can create databases with different encoding). The question is - what I (as admin) want to see in my postgresql log, containing errors from all the databases? IMHO we should consider two requirements for the log. First, The file should be readable with a generic text viewer. Second, It should be useful and complete as possible. Now I see following solutions. A. We have different logfiles for each database with different encodings. Then all our logs will be readable, but we have to look at them one by onе and it's inconvenient at least. Moreover, our log reader should understand what encoding to use for each file. B. We have one logfile with the operating system encoding. First downside is that the logs can be different for different OSes. The second is that Windows has non-Unicode system encoding. And such an encoding can't represent all the national characters. So at best I will get ??? in the log. C. We have one logfile with UTF-8. Pros: Log messages of all our clients can fit in it. We can use any generic editor/viewer to open it. Nothing changes for Linux (and other OSes with UTF-8 encoding). Cons: All the strings written to log file should go through some conversation function. I think that the last solution is the solution. What is your opinion? In fact the problem exists even with a simple installation on Windows when you use non-English locale. So the solution would be useful for many of us. Best regards, Alexander On 05/23/2012 09:15 AM, yi huang wrote: > I'm using postgresql 9.1.3 from debian squeeze-backports with > zh_CN.UTF-8 locale, i find my main log (which is > "/var/log/postgresql/postgresql-9.1-main.log") contains "???" which > indicate some sort of charset encoding problem. It's a known issue, I'm afraid. The PostgreSQL postmaster logs in the system locale, and the PostgreSQL backends log in whatever encoding their database is in. They all write to the same log file, producing a log file full of mixed encoding data that'll choke many text editors. If you force your editor to re-interpret the file according to the encoding your database(s) are in, this may help. In the future it's possible that this may be fixed by logging output to different files on a per-database basis or by converting the text encoding of log messages, but no agreement has been reached on the correct approach and nobody has stepped up to implement it. -- Craig Ringer