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/