Encoding conversion API - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Encoding conversion API
Date
Msg-id 200701160108.45583.peter_e@gmx.net
Whole thread Raw
List 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/


pgsql-hackers by date:

Previous
From: Darcy Buskermolen
Date:
Subject: Re: Autovacuum improvements
Next
From: "Takayuki Tsunakawa"
Date:
Subject: Re: [GENERAL] Checkpoint request failed on version 8.2.1.