Skip site navigation (1) Skip section navigation (2)

PQexecParams and wchar_t

From: Rob <motorhead9876(at)yahoo(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: PQexecParams and wchar_t
Date: 2007-08-21 20:03:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Does anyone have an example of passing a UTF8 wchar_t character string to PQexecParams() working? For the life of me I can't get it to work. The best I've gotten is the first character of the string is added to my table.

The database uses UTF8 encoding, but no combination of parameters to PQexecParams that I've found gets the whole string into my function. I'm guessing that since that PQexecParams takes an array of const char * that the interface has no way to guess that the parameters are actually wide characters. And since (for english encoding) the data is stored in the first byte of the two byte character, the interface only grabs the first byte of the wide string, thinking the second byte is a null terminator.

Specifying the length of the wchar parameter makes no difference. Is there any way to tell the interface that the parameter is a wide character string?

Any help greatly appreciated.


Pinpoint customers who are looking for what you sell. 


pgsql-interfaces by date

Next:From: Jeroen T. VermeulenDate: 2007-08-21 20:33:55
Subject: Re: PQexecParams and wchar_t
Previous:From: Jeroen T. VermeulenDate: 2007-08-21 11:39:27
Subject: Re: Query performance

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group