ibmdb / node-ibm_db

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

Special characters appear in "�" accents. #913

Closed SFIPS closed 1 year ago

SFIPS commented 1 year ago

I am using the ibm_db library. My development environment runs on windows. Special characters appear in "�" accents.

When I make requests to the database the response looks like this:

{ "COLNAME": "TELEFONO1", "DESCRIPCION": "Tel�fono", "ALIAS_CAMPO": "SVV.TELEFONO1" }

When it should be:

{ "COLNAME": "TELEFONO1", "DESCRIPCION": "Teléfono", "ALIAS_CAMPO": "SVV.TELEFONO1" } I have tried passing in the connection string DBCODEPAGE=1208 but it still doesn't work. I don't know what it could be.

let connStr = "DRIVER={IBM}; DBCODEPAGE=1208; DATABASE=" + process.env.DB_DATABASE + ";HOSTNAME=" + process.env.DB_HOSTNAME + ";PORT=" + process.env.DB_PORT + ";PROTOCOL=TCPIP;UID=" + process.env.DB_UID + ";PWD=" + process.env.DB_PWD + ";";

bimalkjha commented 1 year ago

@SFIPS You are using wrong keyword. DBCODEPAGE is not a valid keyword to be used in connection string. You need to set system environment variable DB2CODEPAGE=1208. If you are able to reproduce the issue using windows command line, then just run below commands from terminal:

set DB2CODEPAGE=1208
node yourtestProgram.js

Thanks.

bimalkjha commented 1 year ago

@SFIPS I hope above steps has solved your problem. Please let us know if we can close this issue? Thanks.

bimalkjha commented 1 year ago

Add process.env.DB2CODEPAGE = 1208; at the start of your application to fix this issue. Thanks.