Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VNPsg-00085W-8r for pgsql-odbc@arkaria.postgresql.org; Sat, 21 Sep 2013 16:18:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VNPsf-0003ys-Et for pgsql-odbc@arkaria.postgresql.org; Sat, 21 Sep 2013 16:18:01 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VNPse-0003yl-Gw for pgsql-odbc@postgresql.org; Sat, 21 Sep 2013 16:18:00 +0000 Received: from vps-server24.sylconia.nl ([95.211.48.80]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VNPsX-00062e-5s for pgsql-odbc@postgresql.org; Sat, 21 Sep 2013 16:17:59 +0000 Received: from [192.168.4.231] (227-151-045-062.dynamic.caiway.nl [62.45.151.227]) (authenticated bits=0) by vps-server24.sylconia.nl (8.14.4/8.14.4) with ESMTP id r8LGIZ3a032317 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Sat, 21 Sep 2013 16:18:35 GMT Message-ID: <523DC699.8060509@exalondelft.nl> Date: Sat, 21 Sep 2013 18:17:29 +0200 From: "W. de Hoog" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: problem converting ucs2 to utf8 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Sylconia-MailScanner-Information: Please contact the ISP for more information X-Sylconia-MailScanner-ID: r8LGIZ3a032317 X-Sylconia-MailScanner: Found to be clean X-Sylconia-MailScanner-MCPCheck: X-Sylconia-MailScanner-From: wdehoog@exalondelft.nl X-Spam-Status: No X-Pg-Spam-Score: 0.8 (/) 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 Hi, I am trying to connect postgres to mono on ubuntu 64 bits. There is a problem when converting wchar data from a bound parameter. The call to ucs2_to_utf8 in convert.c always fails. Doing some mylog stuff I noticed the passed parameters behave weird. The output of (wj is an int). mylog("wj C_WCHAR=%s used=%d, WCLEN=%d\n", buffer, used, WCLEN); mylog(" used stuff: %d:%d:%d\n", used > 0, used / WCLEN, used > 0 ? used / WCLEN : used); wj = used; mylog(" more used stuff: %d:%d:%d\n", wj > 0, wj / WCLEN, wj > 0 ? wj / WCLEN : wj); is [140667133007808]wj C_WCHAR=b used=-3, WCLEN=2 [140667133007808] used stuff: 1:2147483646:2147483646 [140667133007808] more used stuff: 0:-2:-3 so ucs2_to_utf8 does not alloc any space and the operation fails. When I change the call to buf = allocbuf = ucs2_to_utf8((SQLWCHAR *) buffer, wj, &wj, FALSE); used = wj; it seems to work. Anybody an idea what went wrong with the content of the 'used' variable here? regards, -- Willem-Jan de Hoog -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc