Error and wrong lenghth of non-ASCII Unicode string in plpythonu
От | Volker Paul |
---|---|
Тема | Error and wrong lenghth of non-ASCII Unicode string in plpythonu |
Дата | |
Msg-id | 569D27E5.90400@v-paul.de обсуждение исходный текст |
Ответы |
Re: Error and wrong lenghth of non-ASCII Unicode string in
plpythonu
|
Список | pgsql-bugs |
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;
В списке pgsql-bugs по дате отправления: