Encoding conversion API

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Encoding conversion API
Date: 2007-01-16 00:08:45
Message-ID: 200701160108.45583.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm becoming confused by the encoding conversion API, in particular by
the function

pg_do_encoding_conversion(unsigned char *src, int len, int src_encoding,
int dest_encoding);

Since the function in various circumstances passes back src directly,
you might get back a string that encompasses the equivalent of more
than len bytes of src. Or if you pass a string that is not
null-terminated (which would appear to be allowed, since you pass len),
you might get back a null-terminated string or not. And if you don't,
you don't know how long it is. So it seems that the only safe way to
work with this is that src must be a regular null-terminated string,
but then why must len be passed?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Browse pgsql-hackers by date

  From Date Subject
Next Message Takayuki Tsunakawa 2007-01-16 01:20:04 Re: [HACKERS] Checkpoint request failed on version 8.2.1.
Previous Message Darcy Buskermolen 2007-01-15 23:38:42 Re: Autovacuum improvements