Re: Need a way to configure encoding

From: Jon Raiford <raiford(at)labware(dot)com>
To: Dave Cramer <davecramer(at)postgres(dot)rocks>, Abhishek Kumar <abhishek(dot)aak0(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Need a way to configure encoding
Date: 2024-08-13 19:01:11
Message-ID: SA1PR17MB535030EC8F78142542A29D85BE862@SA1PR17MB5350.namprd17.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

From what I understand, in recent versions of Windows you can enable UTF8 Win32 API support. Then the ODBC “A” (not “W”) calls will work with UTF8. The conversion, if needed, happens in the driver manager or in the OS. On MacOS and Linux I believe you can already use the “A” calls to do this.

https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page

Jon

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
Date: Tuesday, August 13, 2024 at 2:41 PM
To: Abhishek Kumar <abhishek(dot)aak0(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: Need a way to configure encoding
Hi Abhishek,

Unfortunately, no not without considerable work in the driver.
Dave Cramer
www.postgres.rocks<http://www.postgres.rocks>

On Tue, 13 Aug 2024 at 10:50, Abhishek Kumar <abhishek(dot)aak0(at)gmail(dot)com<mailto:abhishek(dot)aak0(at)gmail(dot)com>> wrote:
Yes. I am indeed using the Unicode version of the driver. I am constrained to use it. Is there a possibility where we can configure something to get SQL_VARCHAR instead of SQL_WVARCHAR for varchar column in the UNICODE driver?

Regards,
Abhishek Kumar

On Tue, 13 Aug 2024 at 4:10 PM, Dave Cramer <davecramer(at)postgres(dot)rocks> wrote:
Greetings,

I think you are using the unicode version of the driver. If you use the non-unicode version it will use the locale settings and strings will be returned as SQL_VARCHAR.

Dave Cramer
www.postgres.rocks<http://www.postgres.rocks>

On Tue, 13 Aug 2024 at 05:05, Abhishek Kumar <abhishek(dot)aak0(at)gmail(dot)com<mailto:abhishek(dot)aak0(at)gmail(dot)com>> wrote:
Can someone please help me answer this question?

Regards,
Abhishek Kumar

On Tue, Aug 6, 2024 at 3:01 PM Abhishek Kumar <abhishek(dot)aak0(at)gmail(dot)com<mailto:abhishek(dot)aak0(at)gmail(dot)com>> wrote:
Hi,

I am working on a linux ODBC C++ application and using psqlodbc driver. I need help on the below few questions.

1. Is there a way in which we can make the psqlodbc code work according to the client encoding?
For example, if my application encoding is UTF-8, i would want the types and strings returned to my application in UTF-8. I think by default, it is returning UTF-16 strings.

2. The default behaviour of the driver is when we have a VARCHAR column in a table, it returns SQL_WVARCHAR as the type. Is there a possibility where we can configure something (maybe at connection string), such that it returns SQL_VARCHAR for VARCHAR column and not SQL_WVARCHAR ?

Please help me in answering the above questions.

Regards,
Abhishek Kumar

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Abhishek Kumar 2024-08-22 13:21:55 Need information on bind type for certain data types in PostgreSQL
Previous Message Dave Cramer 2024-08-13 18:32:38 Re: Need a way to configure encoding