Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aLKM7-00039O-Pk for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jan 2016 00:41:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aLKM7-0000qL-7T for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jan 2016 00:41:07 +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) (envelope-from ) id 1aLE55-0006H7-16 for pgsql-bugs@postgresql.org; Mon, 18 Jan 2016 17:59:07 +0000 Received: from mout.kundenserver.de ([212.227.126.187]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.84) (envelope-from ) id 1aLE52-0008Ld-2o for pgsql-bugs@postgresql.org; Mon, 18 Jan 2016 17:59:05 +0000 Received: from [172.16.1.2] ([91.15.32.114]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0MF8bn-1aNgmk00Tr-00GMLi for ; Mon, 18 Jan 2016 18:59:01 +0100 To: pgsql-bugs@postgresql.org From: Volker Paul Subject: Error and wrong lenghth of non-ASCII Unicode string in plpythonu Message-ID: <569D27E5.90400@v-paul.de> Date: Mon, 18 Jan 2016 18:59:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:3MJ3UiOYhjEt2wKbftp2h8wt78XS4ndwVmCAn4BYa9EfnN/sYx2 LXFuQrvvX3aVg1YKlQmHSEuqHM1sxzMhD0ph2PlhEd4h7kWtF5qdMBbkNVnUZYQYs60qUT+ 6BQ92hX1fSqOIIc6yrkv5H7s9uR3842pU1EgWvPTyIAwJ29tGDEJQokSzXK1fgmTSx3tLBj ruV6Yi6sLS0AVkAENfgJQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:YZqdjCo/fyY=:IUhYU0BXXDERWS7zfBI9HK M0fix0Ldf1KTD9StAXdikLthG83tAWtYpW78RuYeK1qgZk/swFR3F0Toi0Zg0316B40z3xLKr KRB1NqC5laamS4cgCgDzps01u2TexwmWo9+RVmt78BIWeDeehw4j0z1FF7WrK4PVegbtx8LUK MohravEcz1onZDxFLeXThSBSuGi/T36ZXx9ITM3JOyqbesE+tyRUNl87AC/qPYMiGoXo4tfCK TNtUdmr4cMbsjV1qOJtvARA5uuWprtvb8NG37VmYiiysWwtS4FFgPwdnbCNSWnEAu94bINNbS JpybFwVMFfgN2SFHW1/TVcF7nXS8NstTi9II8t6sLQiEuvsdwX9EyXKLlOu9iIDuWCUNO9gUv cOPKKV3T3PkQsQeZhGAQ1GdiRv2IZHh0KGwQ3Ba2vEgvRKJmb5LWT8LFzG6PGVAnMNSyWdWKt 24yfS6LqOB+OLWMGWwNb1VbOECvfc2tugbMGNhX9g3IoAWzeppieu0ywMUKJeBNd+PTgusp3s EGtyuHaCbVC7k2bOIr0QMUpv1XqiydkDlfJ3pVGIy6P+70ZEPIaGQB92R1zzodmqaqnhr8Cet odDXjmssvQaCTnoXtPquvjza9RtIBIKkElbrtgmQs4xPEPOc8aOz+UdQR39OmcnuPVmLwb7s0 PiLm+y6NEdfE1+cTUPEqYsqreQaumo1BuzaBKNjY0it6T2hilRTqlYUt6JRh6lb9L8cuJqDTb /iwhJdzz2BVZhmlJ X-Pg-Spam-Score: -1.9 (-) 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 Hi, the following plpythonu function reveals wrong length calculation and error on accessing single characters in a Unicode string. Is the problem solved in more recent versions? Or is there a possibility to work around the problem? CREATE OR REPLACE FUNCTION test_plpython_unicode() RETURNS TEXT AS $$ s = u"abc" plpy.notice("s:%s len:%d; 2+:%s" % (s, len(s), s[2:])) # output: NOTICE: s:abc len:3; 2+:c s = u"äbc" plpy.notice("len:%d; 2+:%s" % (len(s), s[2:])) # output: NOTICE: len:4; 2+:bc # expected: NOTICE: len:3; 2+:c # Note that including s:%s as above leads to an error for c in u"abcÄÖÜ": plpy.notice(c) # output: (the first umlaut leads to error, even to error in error reporting) #NOTICE: a #NOTICE: b #NOTICE: c #ERROR: plpy.Error: could not parse error message in plpy.elog # platform info: # psql (9.3.10, server 9.1.18) # Ubuntu 14.04.3 LTS $$ LANGUAGE plpythonu; -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs