ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
188 stars 151 forks source link

Bug Report, English displays fine but non-English languages break when using DB2 connection ibm_db in nodejs #918

Closed mbleeDev closed 1 year ago

mbleeDev commented 1 year ago

I used ibm_db to connect to a db2 db in nodejs, it connects fine and even selects, but I have one problem.

I'm getting a language breaking issue.

There is a problem that the language breaks even if I declare like below. Or how can I make the language not break?

English is fine, but other languages are broken. The DB2 side is UTF-8, and when I query the same query with dbTool, the language is not broken.

var connStr = "DATABASE=database;HOSTNAME=ip;PORT=port;UID=id;PWD=pass;PROTOCOL=TCPIP;charset=utf8";

How can we ensure that non-English languages are not broken?

Results from using nodejs db2 ibm_db)

[ { COMPANYID: '000001', USERID: 'TEST01', USERNAME: '������', USEYN: 'Y' }, { COMPANYID: '000001', USERID: 'TEST02', USERNAME: '����', USEYN: 'Y' } ]

Steps to Reproduce:

1. 2.

bimalkjha commented 1 year ago

@mbleeDev You have not answered the questions asked in issue template. We want to know which OS you are using: Mac, Windows or Linux? To solve your issue, you need to set system level environment variable DB2CODEPAGE=1208 and then run your app. You can also code in your app after importing ibm_db as process.env.DB2CODEPAGE = 1208;. Thanks.

mbleeDev commented 1 year ago

Thank you. I tried the process.env.DB2CODEPAGE = 1208; you mentioned and it worked.

Thank you!