简体   繁体   English

Windows上的Node.JS + ibm_db + DB2 LUW 9.7的代码页问题(例如,德语变音符号)

[英]Codepage problem (e.g. german umlauts) with Node.JS + ibm_db + DB2 LUW 9.7 on Windows

We can successfully access IBM DB2 LUW Server 9.7 from Node.JS on Widows client using the npm package ibm_db. 我们可以使用npm包ibm_db从Widows客户机上的Node.JS成功访问IBM DB2 LUW Server 9.7。

But we do have a problem with the chacarter encoding in the result set of a ibm_db SQL query. 但是,ibm_db SQL查询的结果集中的字符编码确实存在问题。 The data in the JavaScripte result set is already misformed when it comes to the german umlauts äÄöÖüÜß. 当涉及到德国变音符号äÄöÖüÜß时,JavaScripte结果集中的数据已经变形。

If we do the identical SQL query at the command line (db2cmd.exe), everything is fine including the umlauts. 如果我们在命令行(db2cmd.exe)上执行相同的SQL查询,那么包括变音符号的一切都很好。

If we check with JavaScript the encoding of the umlauts in the SQL result set as interger (string.charCodeAt(index)) we find the umlauts already misformed. 如果我们使用JavaScript检查SQL结果集中的变音符号的编码为整数(string.charCodeAt(index)),我们会发现变音符号格式错误。 All different umlauts have been converted into one and the same dec:65533/hex:FFFD/char:' '. 所有不同的变音符号都已转换为一个且相同的dec:65533 / hex:FFFD / char:'。'

We checked also the SQL column charset within the database with: 我们还使用以下命令检查了数据库中的SQL列字符集:

select name,tbcreator,codepage from sysibm.syscolumns where ...

giving the result 1252. 得到结果1252。

Other futile attempts: 其他徒劳的尝试:

  • Using SL CAST(....CCSID ####) 使用SL CAST(.... CCSID ####)
  • setting property in db URL (which connection property is the one to use? Documentation hard to find) 在db URL中设置属性(要使用哪个连接属性?很难找到文档)
  • setting db_options['codeSet'] to 1252, windows-1252, UTF-8, 1208... when opening connection ibm_db.openSync(db_url, db_options); 打开连接ibm_db.openSync(db_url,db_options)时,将db_options ['codeSet']设置为1252,windows-1252,UTF-8、1208 ...;

Hmmmm....here I do stuck a litte. 嗯....我在这里塞了一个垃圾。 What's wrong? 怎么了?

Thx for any help. 感谢任何帮助。

Environment: 环境:

  • Windows 10 Windows 10
  • node.js 10.15.1 node.js 10.15.1
  • ibm_db 2.5.0 ibm_db 2.5.0
  • npm 6.4.1 npm 6.4.1
  • IBM DB2 Server for LUW 9.7 适用于LUW 9.7的IBM DB2服务器

Have you tested setting the Windows system environment variable DB2CODEPAGE=1208 ? 您是否测试过设置Windows系统环境变量DB2CODEPAGE = 1208? ( you may need to restart after setting it , to allow your stack to pick it up) (设置完之后,您可能需要重新启动,以允许您的堆栈拿起它)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM