Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WzBJo-0005Ww-QS for pgsql-odbc@arkaria.postgresql.org; Mon, 23 Jun 2014 20:58:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WzBJo-0006ei-6u for pgsql-odbc@arkaria.postgresql.org; Mon, 23 Jun 2014 20:58:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WzBJn-0006eb-7O for pgsql-odbc@postgresql.org; Mon, 23 Jun 2014 20:58:23 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by makus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WzBJf-0001IS-4G for pgsql-odbc@postgresql.org; Mon, 23 Jun 2014 20:58:21 +0000 Received: (qmail 25802 invoked by uid 512); 23 Jun 2014 20:58:12 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 23 Jun 2014 20:58:12 -0000 Received: from unknown (HELO ?192.168.1.8?) (183.76.63.174) by sd.tpf.co.jp with SMTP; 23 Jun 2014 20:58:12 -0000 Message-ID: <53A894E9.3070502@tpf.co.jp> Date: Tue, 24 Jun 2014 05:58:17 +0900 From: "Inoue, Hiroshi" User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Heikki Linnakangas , "pgsql-odbc@postgresql.org" Subject: Re: Non-ASCII DSN name troubles References: <53A56E5E.90808@vmware.com> In-Reply-To: <53A56E5E.90808@vmware.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org (2014/06/21 20:37), Heikki Linnakangas wrote: > Hi, > > If you try to create a data source with a name that contains non-ASCII > characters, funny things will happen. I wouldn't expect the ANSI driver > to support that, but a Unicode driver ought to handle it. Currently NON-ascii characters are not recommended because they are mainly used at connection time. Though Unicode version SQLDriverConnect uses UTF-8 encoded user, password, database ... because I don't think of other ways, it has little meaning IMHO. Was there a decision that the encoding of user, password or database is utf-8? > 1. We always use the ANSI versions of the functions to read/write the > config, SQLGetPrivateProfileString/SQLWritePrivateProfileString. In the > Unicode driver, I think we should be using the Unicode *W variants of > those functions, otherwise we cannot handle characters that don't have a > representation in the current system codepage. > > 2. Even if all the characters can be represented in the system codepage, > when built as a Unicode driver, we internally pass all strings as UTF-8 > encoded char[] arrays, and convert between UTF-8 and UCS-2 in the > wrapper functions in odbcapiw.c. We also do that for the DSN name in > SQLDriverConnextW(), but we pass the UTF-8 encoded DSN name to > SQLGetPrivateProfileString() function, to get the config options. That > doesn't work, because SQLGetPrivateStringProfileString() expect the > string to be encoded in the system codepage, not UTF-8. Again, we should > be using the Unicode version, SQLGetPrivateProfileStringW(). > > 3. We don't use the Unicode versions of the GUI functions, like > GetDlgTextItem(), when dealing with the configuration dialog. That again > means that the GUI cannot handle characters outside the system codepage, > but we also don't convert the strings to UTF-8 like we do to strings > coming through SQLDriverConnectW() and other API functions, so there's > another mismatch. > > Attached patch fixes those issues, allowing you to create a use any > Unicode characters in the DSN name, or any other configuration fields, > with the Unicode driver. > > > This changes the behavior of how username and password are handled in > the Unicode driver. Without this patch, the username is read from the > registry in the system codepage, and also sent as such to the server. > After the patch, it's always sent to the server in UTF-8. I think that's > more sane behavior, but there's a small chance of breaking existing > installation that depend on the old behavior. So we probably should > include this patch when we bump the major version number to 9.4. > > - Heikki > > > -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc