Re: c++ convert wchar_t to UTF-8 for DB

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: c++ convert wchar_t to UTF-8 for DB
Date: 2013-08-09 21:01:02
Message-ID: 5205588E.4070309@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/7/2013 8:49 AM, ciifrancesco(at)tiscali(dot)it wrote:
> http://www.postgresql.org/message-id/4BF575E6.5060203@hogranch.com
> I am in the situation described in the message.

except linux isn't windows, and you're probably not using GBK encoding
for your database, so ... what exactly is the 'same' about your situation?

> I have a char* in C++ and i want to put in my db, but most of the non
> ASCII charachers are broken.
> So i used wchar_t, but the following function doesn't exist:

this char *, what encoding are these nonascii characters in? what
client_encoding is your database connection using?

wchar is 16 bits per character, which isn't even remotely the same as
char* (8 bits per char), you can't just cast a pointer to one to a
pointer to the other, that would be like mixing integer and char.

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2013-08-09 21:01:50 Re: incremental dumps
Previous Message Jeff Janes 2013-08-09 19:32:55 Re: Weird error when setting up streaming replication