IBM / node-odbc

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

[BUG] German character are not displayed correctly (üöäß) ����� #357

Closed Relbot closed 7 months ago

Relbot commented 10 months ago

Describe your system

Describe the bug When querying the database all the none english characters get scrambled and displayed as � (the ? inside a dimond shaped character) The characters are displayed correctly in the ZCC/PCC (Zen Control Center) when I set the ZenCC connection encoding to CP437 

image

But in my nodejs application I didn't manage to get the right result.  Thinks I tried out:

  1. Changing through all of the encoding settings in the DSN (none, automatic and OEM/ANSI)
  2. Tried to use the Pervasive ODBC UNICODE Driver
  3. Changing the local encoding from my machine, where the nodejs server is running, to utf-8

Previously, I had the same problem with Excel as well, but there it was easy; I just needed to change the encoding in the DSN to OSM/ANSI. But there was one difference compared to my nodejs server. When Excel displayed the characters in the wrong way, it showed characters like this instead: ”š™Ž™á and not only � for all characters, like my nodejs server

When I connect with python via pyodbc to the database I also get the right result with the DSN encoding setting OSM/ANSI

So the problem needs to be with nodejs and the OBDC library.

This is how I connect to the database     const p = await odbc.pool("DSN=DSNNAMEHERE");

image2

I have already worked a whole week on this problem and cannot fix it. Help apprecciated

kadler commented 10 months ago

This is likely due to #292. Currently any character data is bound as SQL_C_CHAR and treated as if it was UTF-8. In this case, the driver seems to be returning it in CP437 or another ANSI Windows codepage.

PyODBC doesn't have this issue, because by default it binds SQL_C_CHAR to SQLWCHAR and let's the driver convert to UTF-16 so it's a consistent encoding.

Relbot commented 10 months ago

This is likely due to #292. Currently any character data is bound as SQL_C_CHAR and treated as if it was UTF-8. In this case, the driver seems to be returning it in CP437 or another ANSI Windows codepage.

PyODBC doesn't have this issue, because by default it binds SQL_C_CHAR to SQLWCHAR and let's the driver convert to UTF-16 so it's a consistent encoding.

Hey @kadler, Do you plan on fixing this in the near future? Regards Tell

stale[bot] commented 7 months 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.