Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U67mi-0007jJ-Tl for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Feb 2013 23:00:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U67mh-00039x-Rm for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Feb 2013 23:00:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U67mg-00038e-IU for pgsql-hackers@postgresql.org; Thu, 14 Feb 2013 23:00:06 +0000 Received: from mail-vc0-f172.google.com ([209.85.220.172]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U67md-00035o-6f for pgsql-hackers@postgresql.org; Thu, 14 Feb 2013 23:00:05 +0000 Received: by mail-vc0-f172.google.com with SMTP id l6so1895906vcl.3 for ; Thu, 14 Feb 2013 15:00:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:x-gm-message-state; bh=SvjxSHltIdj34csVs91DhwkPVVJTk4CiNi1aJKmv8KY=; b=XWPWcV8vPqekrx3fEhlJ7nZhw7qV7Eqe1337UIm8iAXYWZqw9pxiwIekBJcxuL4S8g nx+ONqLBAteccsLKXN1OGo9/mOu0odwtKg2W0TRc9bTjmgiBIm5dmYYfHx+JM2RA9qO3 XVyvsTYoiyISvnDeaDIdo7lYSAebhk0HA/Dv+dw/Kr9AZhJ9XA775xLMPm4aE8cX/zdz aA+bnW5DCy3J5uTm4ZE3dLyELc6PL9IRAVGJ+n45wc4J7hvMqhFI6w8Km5AE9E/m8Uab s5wvDJr1Xd535Y8Nj65VZqSIk7LUhBvbT8eIju6dVJZiVBL5LZ43G9gL9D5/J6+PaLV6 W8IA== X-Received: by 10.58.253.161 with SMTP id ab1mr437864ved.55.1360882801744; Thu, 14 Feb 2013 15:00:01 -0800 (PST) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPS id a19sm78248593vdh.9.2013.02.14.14.59.59 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 14 Feb 2013 15:00:00 -0800 (PST) Date: Thu, 14 Feb 2013 17:59:57 -0500 From: Noah Misch To: Alexander Law Cc: Tom Lane , pgsql-hackers , Magnus Hagander , Andrew Dunstan Subject: Re: BUG #7493: Postmaster messages unreadable in a Windows console Message-ID: <20130214225957.GA5626@tornado.leadboat.com> References: <5100F3F6.3050107@2ndQuadrant.com> <51013C2C.5020703@dunslane.net> <20130124161954.GA2448@tornado.leadboat.com> <5101A1C4.3020407@dunslane.net> <5107656C.1050400@gmail.com> <28316.1359471244@sss.pgh.pa.us> <20130130015155.GD3524@tornado.leadboat.com> <5108B6E1.9070503@gmail.com> <20130210210259.GA7401@tornado.leadboat.com> <511C8E11.7090407@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <511C8E11.7090407@gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQlfCosAcqVoC9n5QzK0XodqBqaom7vQ3atuPkFXbok+U/TTG+bG1IfK5VD5qijVlNZKwoYq X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Thu, Feb 14, 2013 at 11:11:13AM +0400, Alexander Law wrote: > Hello, >>>>> Alexander Law writes: >>>>>> Please look at the following l10n bug: >>>>>> http://www.postgresql.org/message-id/502A26F1.6010109@gmail.com >>>>>> and the proposed patch. >> With your proposed change, the problem will resurface in an actual SQL_ASCII >> database. At the problem's root is write_console()'s assumption that messages >> are in the database encoding. pg_bind_textdomain_codeset() tries to make that >> so, but it only works for encodings with a pg_enc2gettext_tbl entry. That >> excludes SQL_ASCII, MULE_INTERNAL, and others. write_console() needs to >> behave differently in such cases. > Thank you for the notice. So it seems that "DatabaseEncoding" variable > alone can't present a database encoding (for communication with a > client) and current process messages encoding (for logging messages) at > once. There should be another variable, something like > CurrentProcessEncoding, that will be set to OS encoding at start and can > be changed to encoding of a connected database (if > bind_textdomain_codeset succeeded). I'd call it MessageEncoding unless it corresponds with similar rigor to a broader concept. >> On Tue, Feb 12, 2013 at 03:22:17AM +0000, Greg Stark wrote: >>> >But that said I'm not sure saying the whole file is in an encoding is >>> >the right approach. Paths are actually binary strings. any encoding is >>> >purely for display purposes anyways. >> For Unix, yes. On Windows, they're ultimately UTF16 strings; some system APIs >> accept paths in the Windows ANSI code page and convert to UTF16 internally. >> Nonetheless, good point. > Yes, and if postresql.conf not going to be UTF16 encoded, it seems > natural to use ANSI code page on Windows to write such paths in it. > So the paths should be written in OS encoding, which is accepted by OS > functions, such as fopen. (This is what we have now.) To the contrary, we would do better to use _wfopen() after converting from the encoding at hand to UTF16. We should have the goal of removing our dependence on the Windows ANSI code page, not tightening our bonds thereto. As long as PostgreSQL uses fopen() on Windows, it will remain possible to create a file that PostgreSQL cannot open. Making the full transition is probably a big job, and we don't need to get there in one patch. Try, however, to avoid patch designs that increase the distance left to cover. Thanks, nm -- Noah Misch EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers