Re: psqlodbclibpq 8_1_03 unicode problem

From: "Mario A(dot) Soto Cordones" <mario_soto(at)venezolanadeavaluos(dot)com>
To: <Marko(dot)Ristola(at)kolumbus(dot)fi>
Cc: <jfradkin(at)wazagua(dot)com>, <Josef(dot)Springer(at)joops(dot)com>, <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: psqlodbclibpq 8_1_03 unicode problem
Date: 2005-08-10 17:42:52
Message-ID: 32861.200.35.66.77.1123695772.squirrel@mail.venezolanadeavaluos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi

I find this mail very well, but I don't see I eat up he can help with the
psqlodbc problem.

thank you

>
> Characters will go into question marks, if the character conversion is
> not defined
> properly, or the input for the conversion functions is incorrect.
>
>
> Here is something about ANSI C standard about the character conversions:
>
>
> setlocale(LC_ALL,"C");
> After calling this function in main() C program, the program
> works as follows:
>
> LATIN1 works with itself, because it does not need any conversions and
> it is single byte
> encoding.
> UTF-8 works with itself, because it does not need any locale specific
> information to work.
>
> Conversion from UTF-8 into LATIN 1does not work. Non-ascii characters
> will be converted
> into question marks.
> Conversion from LATIN1 into UTF-8 does not work. Non-ascii characters
> will be converted
> into question marks.
>
> setlocale(LC_ALL,""); or setlocale(LC_CTYPE,"");
>
> ANSI C definition for this is, that locale environment settings (Windows
> settings, or Linux environment settings), for example
> LC_CTYPE=fi_FI.iso8859-1 is used. This way conversions between LATIN1
> and UTF-8 will work, if the environment is ANSI C compilant (it should).
>
> So the LC_CTYPE must match with the multibyte data. Windows settings
> will be activated
> with the "" setting: an empty string means the environment default.
>
> There is a good book about ANSI C 99: "The C standard"
>
>
> So, how this relates to psqlodbc?
>
> Case 1:
> Typically user needs to do the conversions outside US.
> Inside psqlodbc, do setlocale(LC_CTYPE,""), do the LATIN1/UTF-8
> -conversion and do setlocale(LC_CTYPE,"C");
>
> Case 2:
> Sometimes user does not want to do any charset conversions
> because of performance reasons.
> Don't support this one.
>
> Case 3:
> User has already done setlocale(LC_CTYPE,"");
> To make Case 1 and Case 3 work, we do inside ODBC the following:
> strncpy(prev_locale,setlocale(LC_CTYPE,NULL),64);
> setlocale(LC_CTYPE,""), do the LATIN1/UTF-8 -conversion
> and do setlocale(LC_CTYPE,prev_locale);
>
> Case 4:
> A threaded application needs to work also.
> Under Windows, setlocale() can be altered to behave as thread local, so
> that every
> thread has it's own locale setting.
> Under Linux, at least iconv() conversion facility works, even though it
> is not ANSI C.
>
>
> Regards, Marko Ristola
>
>
>
> Joel Fradkin wrote:
>
>>Not sure why your getting that.
>>Is the database Unicode?
>>When I was in SQLASCII mine read as ?
>>The older driver 7.4 reas SQLASCII ok and presented French characters
>> ok, but newer version did not.
>>When I converted to a Unicode database I could read the French
>> characters ok with the new driver.
>>
>>By the way been up Since Monday no odbc errors yet :)
>>
>>Joel Fradkin
>>
>>Wazagua, Inc.
>>2520 Trailmate Dr
>>Sarasota, Florida 34243
>>Tel. 941-753-7111 ext 305
>>
>>jfradkin(at)wazagua(dot)com
>>www.wazagua.com
>>Powered by Wazagua
>>Providing you with the latest Web-based technology & advanced tools. ©
>> 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
>> This email message is for the use of the intended recipient(s) and may
>>contain confidential and privileged information. Any unauthorized
>> review, use, disclosure or distribution is prohibited. If you are not
>> the intended recipient, please contact the sender by reply email and
>> delete and destroy all copies of the original message, including
>> attachments.
>>
>>
>>
>>
>>-----Original Message-----
>>From: pgsql-odbc-owner(at)postgresql(dot)org
>>[mailto:pgsql-odbc-owner(at)postgresql(dot)org] On Behalf Of Josef Springer
>> Sent: Wednesday, August 10, 2005 7:58 AM
>>To: pgsql-odbc(at)postgresql(dot)org
>>Subject: Re: [ODBC] psqlodbclibpq 8_1_03 unicode problem
>>
>>I have the same problem and reported a bug.
>>It seems, that Unicode is readed unencoded (one byte per character)
>>
>>Josef Springer
>>
>>Simeó Reig wrote:
>>
>>
>>
>>>>I am using the versionde psqlodbclibpq 8_01_003, to be able to use
>>>> ssl connections, and until the moment works well, but the problem has
>>>> it with
>>>>caracters like:
>>>>
>>>>character Ñ, show like character ?
>>>>character ó, show like character ??
>>>>
>>>>that I can make?
>>>>
>>>>Thank you
>>>>
>>>>
>>>I've the same problem too with spanish and catalan letters, Seems like
>>> it don't support unicode characters.
>>>
>>>Thanks a lot
>>>
>>>
>>>---------------------------(end of
>>> broadcast)--------------------------- TIP 6: explain analyze is your
>>> friend
>>>
>>>
>>
>>
>>
>>
>>---------------------------(end of
>> broadcast)--------------------------- TIP 5: don't forget to increase
>> your free space map settings
>>
>>
>>---------------------------(end of
>> broadcast)--------------------------- TIP 6: explain analyze is your
>> friend
>>
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Chris Hoover 2005-08-10 18:33:22 Re: PG 7.3.4 VS PG 8.0.3 Problem
Previous Message Marko Ristola 2005-08-10 16:43:18 Re: psqlodbclibpq 8_1_03 unicode problem