pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marko Ristola <Marko.Ristola@kolumbus.fi>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Continuing encoding fun....
Date: Tue, 06 Sep 2005 20:56:13 +0300
Message-ID: <431DD83D.5090106@kolumbus.fi> (raw)
In-Reply-To: <bDgNR2rDyrcL.tVbHRDtZ@smtp.1und1.com>
References: <bDgNR2rDyrcL.tVbHRDtZ@smtp.1und1.com>

zuschlag2@online.de wrote:

>Hi Dave
>
>  
>
>>It seems to me that the current case is correct - in the Unicode driver
>>we *must* run with client_encoding = 'UNICODE' or it won't work
>>properly. That said, I wonder if we shouldn't just remove the if()
>>altogether, and unconditionally set the client encoding for the Unicode
>>    
>>

The following might be interesting for you:

If I activate ISO C 99 API, I can do the following:
( I thought, that I used ANSI C 99, but the correct name for the
standard, I meant
  is ISO C 99. It will become default later, maybe it already is with
newest GCCs.)

char cbuf[500];
wchar_t wbuf[500];

setlocale(LC_CTYPE,"");

strcpy(cbuf,"Some multibyte text");
swprintf(wbuf,"%s",cbuf);
Now the text is under wchar_t's internal format, maybe UCS-2.

The following also works:
strcpy(wbuf,L"Some UNICODE text");
sprintf(cbuf,"%ls",wbuf);

So, the UCS-2 and multibyte conversion under ISO C 99 seems to be very easy.
With GCC, with Debian Sarge, this can be done as follows:
gcc -std=c99

I don't have now more time to test, at least today.

Iconv seems to be the solution for more advanced conversions under Linux.

Regards, Marko





view thread (24+ messages)  latest in thread

Message-ID: <431DD83D.5090106@kolumbus.fi>
Permalink:  ../431DD83D.5090106@kolumbus.fi/
Also on:    postgresql.org/message-id/431DD83D.5090106@kolumbus.fi

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: Marko.Ristola@kolumbus.fi
  Subject: Re: Continuing encoding fun....
  In-Reply-To: <431DD83D.5090106@kolumbus.fi>
  References: <bDgNR2rDyrcL.tVbHRDtZ@smtp.1und1.com> <431DD83D.5090106@kolumbus.fi>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox