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;