Thread: [ECPG] Characters set, w_char & co ...

[ECPG] Characters set, w_char & co ...

From
SC
Date:
Hi all !

I'm wondering how charset should ba handled when using embedded C, in particular regarding to memory allocation.

I mean my database is currently using UTF-8, and I successfully inserted (by using pgAdminIII) chinese characters in it.

My question is : in my C code, lets say my table has a 'name' column (let's say VARCHAR(50)), shall I declare :

EXEC SQL BEGIN DECLARE SECTION
w_char    pg_name[50];

or char pg_name[50*4];

or char pg_name[50*2]; ?

When stating VARCHAR[X], X specifies the charactr count, right (not the byte count used for encoding) ?

I've been told about iconv() but not sure what suits the best.

An idea anyone ?

Thank you !

BR

SC