Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btqmL-0006Mk-2j for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 06:43:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btqmK-0003hq-Fu for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Oct 2016 06:43:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btqlf-0002yr-FA for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 06:42:27 +0000 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1btqlc-0000QF-5E for pgsql-bugs@postgresql.org; Tue, 11 Oct 2016 06:42:25 +0000 Received: by mail-pa0-x22c.google.com with SMTP id ry6so9807560pac.3 for ; Mon, 10 Oct 2016 23:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=gFV7C2pIB3nDhPM5JNb9S8eW6Bnu3APVmuGF6rYv7/4=; b=fZO6/sbP13OlQpkNmb9t7KvW7Arrtlslfuni81aERuctwL8zMSXyXRe/98rDZ5WCnd DtcaTtzk/IJ1dfZu67g2frcj+3IIW/xxvRctAIQRWgDFa5OHWRatxY8ki0rE5+I6wBA/ VDieg/pFEmwbuv5AqE1n5BdBK6PJHTlw6k+B0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=gFV7C2pIB3nDhPM5JNb9S8eW6Bnu3APVmuGF6rYv7/4=; b=kBLueVqfSwzaLfIF9C4uQIxJHzzRooa7CaFaYMtG5GRYBpdZ2BxYMg5Wua7TgIdfBU iLpU6JRmta4gd63M6YausgjX/T+j6xDABn3TLfdpnNcsxxfVVvpxurWiszI9sRUWLlCv 4jaEzJyO+yPNyQo9v7F/4Vg0NeM7WhuYlCIndEjMrg+98uu1Kg+kiVIq1fU1dSV8QcHF vTQd6VpG6wCErXJ5qiPSaXPmoCQCj3DYuMuSTPi4w0TccA8CI9fNFmT4Wbb27+23j0Mx 6s0TJ31DxamK2piIYc0eZ9FZj0WcBJRueQQc89DCR9kMq5lkP/d15F5XzK8GkzS+KBT1 WXaA== X-Gm-Message-State: AA6/9RlxuKF+bhl9bmGpDkF6n2jnlSN4c3tWdZQUn2J74n50/nyQsoR0snVkzgp8TjKNpw== X-Received: by 10.66.77.170 with SMTP id t10mr4453776paw.40.1476168141190; Mon, 10 Oct 2016 23:42:21 -0700 (PDT) Received: from tornado.leadboat.com (c-98-248-47-228.hsd1.ca.comcast.net. [98.248.47.228]) by smtp.gmail.com with ESMTPSA id m62sm2154882pfi.10.2016.10.10.23.42.19 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Oct 2016 23:42:20 -0700 (PDT) Date: Tue, 11 Oct 2016 06:42:18 +0000 From: Noah Misch To: =?utf-8?B?6ZiO5YWG54+j?= Cc: pgsql-bugs Subject: Re: language code incompatibility in Windows Message-ID: <20161011064218.GA1041260@tornado.leadboat.com> References: <464164567.47460.1473217348129.JavaMail.root@wmthree-8> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <464164567.47460.1473217348129.JavaMail.root@wmthree-8> User-Agent: Mutt/1.5.24 (2015-08-30) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Wed, Sep 07, 2016 at 11:02:28AM +0800, 阎兆珣 wrote: > For PG 9.1 ~ 9.5 in Windows 7 32bit > > psql can not recognize Chinese database name while pgAdmin III can. > > psql_Chinese This is probably a symptom of a character encoding mismatch. You ran psql in a console window, so psql received your input encoded with the console input code page. Based on [1], pgAdmin III probably used UTF8 encoding in your environment. The default console input code page depends on locale settings, but it is never UTF8. This C program demonstrates psql's ability to connect to a Chinese-named database on Windows (tested with binaries from [2]): /* initdb --locale=C --encoding=UTF8 */ #include int main(int argc, char **argv) { system("createdb \xe5\xa3\xa4"); system("psql -c " "\"select current_database(), octet_length(current_database())\" " "\xe5\xa3\xa4"); return 0; } I recommend against non-ASCII characters in database names. PostgreSQL performs encoding conversion, according to the client_encoding setting, on most of the database session. It does not convert database names; it largely treats them as byte sequences, not text. Non-ASCII database names work fine if every client program uses the same encoding; otherwise, they create the trouble you're experiencing. Avoid non-ASCII role names, too, for the same reasons. [1] https://www.postgresql.org/message-id/CA%2BOCxozjhM5wAj84vjRNWX5TLEYEMYeh37U%3DibJt22m5nqtJmA@mail.gmail.com [2] http://get.enterprisedb.com/postgresql/postgresql-9.5.4-2-windows-x64-binaries.zip -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs