Обсуждение: Transcoding problem with wine and unixodbc

Поиск
Список
Период
Сортировка

Transcoding problem with wine and unixodbc

От
Pierre Couderc
Дата:
I am still trying to excute a MFC application (working with psqlodbc
under WinXP) under wine, unix psqlodbc, and unixodbc.

My application is in ANSI, but the DB is in Unicode, so under Windows, I
use Postgrsql Unicode driver (which transcodes..?) without any  problem.
Under wine, I have tried the 2 drivers (psqlodbcw.so and psqlodbca.so)
and with the same incorrect result.
For exemple <è> becomes <Ã"> (in 2 characters).

Any hint welcome...


Re: Transcoding problem with wine and unixodbc

От
Adrian Klaver
Дата:
On 04/25/2014 04:48 AM, Pierre Couderc wrote:
> I am still trying to excute a MFC application (working with psqlodbc
> under WinXP) under wine, unix psqlodbc, and unixodbc.
>
> My application is in ANSI, but the DB is in Unicode, so under Windows, I
> use Postgrsql Unicode driver (which transcodes..?) without any  problem.
> Under wine, I have tried the 2 drivers (psqlodbcw.so and psqlodbca.so)
> and with the same incorrect result.

Hmm. I would have expected different results.

Are you sure your program actually picked up the change in drivers?

> For exemple <è> becomes <Ã"> (in 2 characters).

Can you get a psql connection to the database?

And if so what does it show?

Also what exactly is the encoding your client is using?

>
> Any hint welcome...
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Transcoding problem with wine and unixodbc

От
Pierre Couderc
Дата:
On 04/26/2014 01:40 AM, Adrian Klaver wrote:
> On 04/25/2014 04:48 AM, Pierre Couderc wrote:
>> I am still trying to excute a MFC application (working with psqlodbc
>> under WinXP) under wine, unix psqlodbc, and unixodbc.
>>
>> My application is in ANSI, but the DB is in Unicode, so under Windows, I
>> use Postgrsql Unicode driver (which transcodes..?) without any problem.
>> Under wine, I have tried the 2 drivers (psqlodbcw.so and psqlodbca.so)
>> and with the same incorrect result.
>
> Hmm. I would have expected different results.
Me too.
>
> Are you sure your program actually picked up the change in drivers?
Yes, I am sure  : I choose "PostgreSQL ANSI" (in odbc.ini) I get a good
result but  the bad <Ã"> result. I change odbc.ini to a unexistant
driver : I get an application error, then I choose "PostgreSQL Unicode",
and I get the same  bad <Ã"> result.
>
>> For exemple <è> becomes <Ã"> (in 2 characters).
>
> Can you get a psql connection to the database?
yes.
>
> And if so what does it show?
>
I do not know (as I do not know how to use pgsql). But I am sure that
the database is Unicode, and for exmple PGadmin III (either on the same
debian machine or on W7) reads it without problem.
> Also what exactly is the encoding your client is using?
>
Mmm, I am not sure to know what is "my" Client. I suppose that the
client of the DB is psqlodbc.
Or if you want to speak of my application, it is under wine in ANSI.
And I do not know who is responsible for translation, normally it should
be the unixodbc or psqlodbc...?


Re: Transcoding problem with wine and unixodbc

От
Adrian Klaver
Дата:
On 04/30/2014 12:23 AM, Pierre Couderc wrote:
>
> On 04/26/2014 01:40 AM, Adrian Klaver wrote:
>> On 04/25/2014 04:48 AM, Pierre Couderc wrote:
>>> I am still trying to excute a MFC application (working with psqlodbc
>>> under WinXP) under wine, unix psqlodbc, and unixodbc.
>>>
>>> My application is in ANSI, but the DB is in Unicode, so under Windows, I
>>> use Postgrsql Unicode driver (which transcodes..?) without any problem.
>>> Under wine, I have tried the 2 drivers (psqlodbcw.so and psqlodbca.so)
>>> and with the same incorrect result.
>>
>> Hmm. I would have expected different results.
> Me too.
>>
>> Are you sure your program actually picked up the change in drivers?
> Yes, I am sure  : I choose "PostgreSQL ANSI" (in odbc.ini) I get a good
> result but  the bad <Ã"> result. I change odbc.ini to a unexistant
> driver : I get an application error, then I choose "PostgreSQL Unicode",
> and I get the same  bad <Ã"> result.
>>
>>> For exemple <è> becomes <Ã"> (in 2 characters).
>>
>> Can you get a psql connection to the database?
> yes.
>>
>> And if so what does it show?
>>
> I do not know (as I do not know how to use pgsql). But I am sure that
> the database is Unicode, and for exmple PGadmin III (either on the same
> debian machine or on W7) reads it without problem.

Once you have psql open, type the query you want:

select * from some_table;

where some_table is the one with the characters you are having problems
with.


>> Also what exactly is the encoding your client is using?
>>
> Mmm, I am not sure to know what is "my" Client. I suppose that the
> client of the DB is psqlodbc.

Well psqlodbc is more of an adapter that is passing information from
your application to Postgres.

> Or if you want to speak of my application, it is under wine in ANSI.

ANSI is a general term. What is important is what character
set(encoding) you are actually using in your application.

> And I do not know who is responsible for translation, normally it should
> be the unixodbc or psqlodbc...?
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Transcoding problem with wine and unixodbc

От
Pierre Couderc
Дата:
Thank you. I comment.

On 04/30/2014 04:10 PM, Adrian Klaver wrote:
> On 04/30/2014 12:23 AM, Pierre Couderc wrote:
>>
>> On 04/26/2014 01:40 AM, Adrian Klaver wrote:
>>> On 04/25/2014 04:48 AM, Pierre Couderc wrote:
>>>> I am still trying to excute a MFC application (working with psqlodbc
>>>> under WinXP) under wine, unix psqlodbc, and unixodbc.
>>>>
>>>> My application is in ANSI, but the DB is in Unicode, so under
>>>> Windows, I
>>>> use Postgrsql Unicode driver (which transcodes..?) without any
>>>> problem.
>>>> Under wine, I have tried the 2 drivers (psqlodbcw.so and psqlodbca.so)
>>>> and with the same incorrect result.
>>>
>>> Hmm. I would have expected different results.
>> Me too.
>>>
>>> Are you sure your program actually picked up the change in drivers?
>> Yes, I am sure  : I choose "PostgreSQL ANSI" (in odbc.ini) I get a good
>> result but  the bad <Ã"> result. I change odbc.ini to a unexistant
>> driver : I get an application error, then I choose "PostgreSQL Unicode",
>> and I get the same  bad <Ã"> result.
>>>
>>>> For exemple <è> becomes <Ã"> (in 2 characters).
>>>
>>> Can you get a psql connection to the database?
>> yes.
>>>
>>> And if so what does it show?
>>>
>> I do not know (as I do not know how to use pgsql). But I am sure that
>> the database is Unicode, and for exmple PGadmin III (either on the same
>> debian machine or on W7) reads it without problem.
>
> Once you have psql open, type the query you want:
>
> select * from some_table;
>
> where some_table is the one with the characters you are having
> problems with.
>
As expected by me, as pgAdminIII, psql prints correctly.
>
>>> Also what exactly is the encoding your client is using?
>>>
>> Mmm, I am not sure to know what is "my" Client. I suppose that the
>> client of the DB is psqlodbc.
>
> Well psqlodbc is more of an adapter that is passing information from
> your application to Postgres.
>
>> Or if you want to speak of my application, it is under wine in ANSI.
>
> ANSI is a general term. What is important is what character
> set(encoding) you are actually using in your application.
>
LATIN1 (ISO-8859-1),
>> And I do not know who is responsible for translation, normally it should
>> be the unixodbc or psqlodbc..


Re: Transcoding problem with wine and unixodbc

От
Adrian Klaver
Дата:
On 04/30/2014 07:36 AM, Pierre Couderc wrote:
> Thank you. I comment.


>>
> As expected by me, as pgAdminIII, psql prints correctly.

Just to be clear where are you connecting from with psql?


>> ANSI is a general term. What is important is what character
>> set(encoding) you are actually using in your application.
>>
> LATIN1 (ISO-8859-1),

Well that should work with the Unicode driver. My guess is there is some
sort of confusion of what the encoding is between the app - psqlodbc -
Postgres.

Is the database you are using only used by your application?

If it is, one possible troubleshooting method would be to set
client_encoding in postgresql.conf to latin1.  This will affect all the
clients connecting to your database, so use with care. For more
information see below:

http://www.postgresql.org/docs/9.3/interactive/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORMAT

http://www.postgresql.org/docs/9.3/interactive/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED





>>> And I do not know who is responsible for translation, normally it should
>>> be the unixodbc or psqlodbc..
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Transcoding problem with wine and unixodbc

От
Pierre Couderc
Дата:
Le 30/04/2014 17:34, Adrian Klaver a écrit :
> On 04/30/2014 07:36 AM, Pierre Couderc wrote:
>> Thank you. I comment.
>
>
>>>
>> As expected by me, as pgAdminIII, psql prints correctly.
>
> Just to be clear where are you connecting from with psql?
Well, I open a terminal on my amd64 debia, jessie, and I ise psql from it.
> , I open a
>
>
>>> ANSI is a general term. What is important is what character
>>> set(encoding) you are actually using in your application.
>>>
>> LATIN1 (ISO-8859-1),
>
> Well that should work with the Unicode driver. My guess is there is
> some sort of confusion of what the encoding is between the app -
> psqlodbc - Postgres.
>
yes.
> Is the database you are using only used by your application?
>
> If it is, one possible troubleshooting method would be to set
> client_encoding in postgresql.conf to latin1.  This will affect all
> the clients connecting to your database, so use with care. For more
> information see below:
>
> http://www.postgresql.org/docs/9.3/interactive/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORMAT
>
>
> http://www.postgresql.org/docs/9.3/interactive/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED
>
>
>
No, I have many clients.
I must find a way to specify that THIS Client is LATIN1. Is there not a
way to specify it in a connect string ? I find notrhing in the doc.

>>>> And I do not know who is responsible for translation, normally it
>>>> should
>>>> be the unixodbc or psqlodbc..
>>
>>
>
>



Re: Transcoding problem with wine and unixodbc

От
Pierre Couderc
Дата:
I answer myself.
Add :
"ConnSettings=SET CLIENT_ENCODING to 'LATIN1'
in odbc.ini

Thank you, Adrian, you did put me in the good direction.

On 04/25/2014 01:48 PM, Pierre Couderc wrote:
> I am still trying to excute a MFC application (working with psqlodbc
> under WinXP) under wine, unix psqlodbc, and unixodbc.
>
> My application is in ANSI, but the DB is in Unicode, so under Windows,
> I use Postgrsql Unicode driver (which transcodes..?) without any
> problem.
> Under wine, I have tried the 2 drivers (psqlodbcw.so and psqlodbca.so)
> and with the same incorrect result.
> For exemple <è> becomes <Ã"> (in 2 characters).
>
> Any hint welcome...
>
>