IBM / node-odbc

ODBC bindings for node
MIT License
144 stars 75 forks source link

Unicode conversion fails #319

Open ErikJansenIRefact opened 1 year ago

ErikJansenIRefact commented 1 year ago

Hi,

The test environment setup:

Database has a single table:

create` table test (col1 `nvarchar(100));

Tested connection to the database with isql (command line tool) and issued the following statement:

insert into test (col1) values (N'Ω');

Tested connection with nodejs and issued the same statement as above on the connection:

const statement =  `insert into IR_TSTGIN.dbo.test (col1) values (N'Ω');`
const result = await connection.query(statement);

Ran both statements above (via isql and with nodejs) with odbc debug enabled.

[ODBC][47379][1679320146.155152][SQLAllocHandle.c][395] Entry: Handle Type = 2 Input Handle = 0x7f987c815200 UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UCS-2-INTERNAL'

[ODBC][46268][1679319075.820124][SQLAllocHandle.c][395] Entry: Handle Type = 2 Input Handle = 0x7f8a88012600 UNICODE Using encoding ASCII 'US-ASCII' and UNICODE 'UCS-2-INTERNAL'

It seems that the locale settings are not applied when connecting via NodeJS odbc to the driverManager. The locale settings are:

LANG="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_CTYPE="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_ALL=

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ErikJansenIRefact commented 1 year ago

Please re-open.

LuisEdMB commented 5 months ago

Hi, any solution?