node-odbc
node-odbc copied to clipboard
[HELP] Change or define charset / encoding?
Hey there!
I was wondering if there's a way to adjust the charset? I can't find anything like that in the docs.
I'm from Germany, so we have quite a lot of datasets which contain special Characters like ä,ö,ü, Unfortunately, those show up as � characters.
Any help would be appreciated :)
Thanks in advance and have an amazing day.
Update: I tried to add CHARSET=UTF-8, CHARSET=ISO8859-1 and CCSID=1208 to the DSN string, but no success so far.
Update: I tried to add
CHARSET=UTF-8,CHARSET=ISO8859-1andCCSID=1208to the DSN string, but no success so far.
I have recently tried to use "CharSet=utf8" (without the dash), and had at least a partial success with SAP Anywhere database. Now writing to the database from node works at least for the characters supported by the locally configured codepage (in my case 1252), and maybe even some more. Sadly, at least in my setup, it did not help to write the more remote codepoints... :-\
@jmbluethner setting the charset is a driver-specific thing, so it would help to know what driver you are using.
@jmbluethner setting the charset is a driver-specific thing, so it would help to know what driver you are using.
Using the ODBC driver for SAP Anywhere 17 on Windows 10. According to ODBC Admin the version number is 17.00.11.6933.
My guess is that this is not so much an issue of the database side of the driver, but the handling by the ODBC interface itself, and probably changing the local settings of Windows changes things. My regional settings are set to Germany, which (afaik) implies codepage 1252 "for non unicode programs". The database codepage is set to 1252.
The current design of the node-odbc, even on Windows is that it binds all character data as SQL_C_CHAR and interprets it as UTF-8. If the driver does not support setting the local encoding, then this will fail for data which isn't UTF-8.
There's an existing issue to support binding as SQL_C_WCHAR instead: https://github.com/markdirish/node-odbc/issues/292
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.