Well my UTF-8 convertion worked, but now I am facing another difficulty, this might not be libpqxx related, but I am not sure

At this point all the convertions work fine, (Using MFC 7.1 libraries as DLLs)
When I tried to switch to using static MFC libraries I got my self in a new error, the error occures at runtime and says that HEAP memory is corrupted, as far as I understood the problem is in fact that during my home-made convertion using MultiByteToWideChar function I am passing memory buffer from pgxx DLLs into an MFC  portion of code and at some point(not sure which) I recieve HEAP error and programm stops in _CRTIMP int __cdecl _CrtIsValidHeapPointer(
        const void * pUserData) ....
I am a bit confused by the fact that error occures only executing statically linked MFC ....

Regards Roman.




Quoting "Jeroen T. Vermeulen" <[EMAIL PROTECTED]>:
On Mon, April 10, 2006 04:01, Roman Shchugarev wrote:

Thanks for a tip BART I've managed to get out a Unicode data using
these
simple functions (WideCharToMultiByte/MultiByteToWideChar):
string toNarrowString( const wchar_t* pStr , int len )
, and may depend on your locale.> {
ASSERT( len >= 0 || len == -1 , _T("Invalid string length: ") =
0 || len == -1 , _T("Invalid string length: ")

Be careful though: the reason why libpqxx can't simply convert your string
for you is that it doesn't know what encoding the string is in!

The database itself is configured to keep its data in a particular
encoding, which in the modern world will *typically* be UTF-8. But this
isn't always the case. Also, even if the data is kept as unicode it
doesn't really matter whether it's in UTF-8 or some other encoding, since
the data will then be converted to your client encoding, and sent to you
in that form.

By default, your client encoding will be whatever your client program's
locale setting is. But you can also explicitly specify to the backend
what encoding you want your data in using the connection's
set_client_encoding() function. I want to support these conversions at
some point, but just haven't had much time to look into it!


Jeroen
_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to