Re: ODBC application works while libpq fails

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: "Inoue, Hiroshi" <h-inoue(at)dream(dot)email(dot)ne(dot)jp>
Cc: PostgreSQL ODBC list <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: ODBC application works while libpq fails
Date: 2017-08-03 04:06:11
Message-ID: CA+FnnTyuAaDHvU-nOi4MFVZvjqCxo_vTED=1=hvthWU7GreaMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi, Hiroshi,

On Wed, Aug 2, 2017 at 12:32 AM, Inoue, Hiroshi
<h-inoue(at)dream(dot)email(dot)ne(dot)jp> wrote:
> Hi Igor,
>
>
> On 2017/08/02 12:40, Igor Korot wrote:
>>
>> Hi,
>>
>> On Mon, Jul 31, 2017 at 9:05 AM, Igor Korot <ikorot01(at)gmail(dot)com> wrote:
>>>
>>> Hi,
>>> I have a very weird situation.
>>>
>>> I am trying to develop an application which will connect to the
>>> PostgreSQL
>>> server thru 2 different methods: thru the ODBC and using libpq.
>>>
>>> Environment:
>>> MacOSX 10.8.
>>> Xcode 4 (latest available for 10.8)
>>> PostgreSQL 9.1 - original from OSX.
>>> Application is compiled with the UNICODE
>>> iODBC DM for OSX 10.8.
>>> Both application and DB server running on the same machine.
>>> The database I'm using was created with the default parameters (just
>>> CREATE DATABASE draft).
>>>
>>> When I connect with the ODBC driver, the application works as expected
>>> - no errors or problems.
>>>
>>> However when I tried to run the application with libpq I received an
>>> error. The error is:
>>>
>>> [quote]
>>> Invalid byte sequence for encoding UTF-8 0xc3\n
>>> [/quote]
>>>
>>> The application is written in C++ (not ObjC++).
>>> The table I am trying to query contains the field with the word
>>> "abc+<ALT225>", which inside the database is translated as
>>> "abc\xc3\x9f".
>>>
>>> What could be the reason for such behavior?
>>>
>>> Is ODBC driver sets the client encoding to some uniform value?
>>> Or there something else?
>>
>> Here is the content of my .odbc.ini for PostgreSQL on Mac:
>>
>> [code]
>> [postgre]
>> Driver = PostgreSQL Unicode Driver
>> host = localhost
>> ServerName = localhost
>> SERVER = localhost
>> PORT = 5432
>> UserName = postgres
>> Password = <my_passwd>
>> Database = draft
>> UseServerSidePrepare = 1
>> [/code]
>>
>> As you can see there is no special encoding settings. So it uses one
>> that is set by default.
>> But using ODBC API works and trying libpq - doesn't.
>>
>> Could someone please help?
>
>
> What is a query which causes a failure?
> What is a result of locale command?

Sorry for the noise.
I think I found the culprit and in the process of fixing it.

I will let you know how it goes.

Thank you.

>
> regards,
> Hiroshi Inoue
>
>>
>> Thank you.
>>
>>
>>> Thank you.

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Matej Mihelič 2017-08-03 12:55:29 New bug or regression between 9.6 releases 0410 and 0310
Previous Message Inoue, Hiroshi 2017-08-02 11:03:27 Re: When doing installcheck, an error message "unresolved external symbol _get_test_dsn ..." displays.