Re: BUG #16200: ESQL/C FETCH of CHAR data delivers to much data for UTF-8
The following change solves our problem:
postgresql-11.4/src/interfaces/ecpg> diff ecpglib/data.c ecpglib/data.c.orig
527,531c527
< /* guru@unixarea.de: strncpy() only varcharsize-1 */
< strncpy(str, pval, varcharsize-1);
< /* guru@unixarea.de: and terminate the string */
< str[varcharsize - 1] = '\0';
< ecpg_log("DEBUG ESQL/C: result [%s] len %d\n", str, strlen(str));
---
strncpy(str, pval, varcharsize);
--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!