Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Unicode conversion fails

未关闭
#319 6 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, nodejs
领域
database

调研方向

使用报告中的 macOS、unixODBC 和 SQL Server 配置,通过 Node.js 连接重现 Unicode 插入,然后将其 ODBC 调试编码行与 isql 结果进行比较。当通过 node-odbc 插入 Ω 后仍能保留该字符时,该 Issue 即得到解决;报告中未指出源文件或测试。

由索引模型根据 Issue 内容生成。

描述

confirmed

Hi,

The test environment setup:

  • MacOS Ventura
  • unixODBC driver manager version 2.3.11
  • Microsoft ODBC Driver 18 For SQL Server
  • SQLServer running in Docker (or on a Windows machine)

Database has a single table:

create` table test (col1 `nvarchar(100));

Tested connection to the database with isql (command line tool) and issued the following statement:

insert into test (col1) values (N'Ω');
  • result is OK

Tested connection with nodejs and issued the same statement as above on the connection:

const statement =  `insert into IR_TSTGIN.dbo.test (col1) values (N'Ω');`
const result = await connection.query(statement);
  • Statement is executed but the result is not OK. The omega charactered is converted to another symbol.

Ran both statements above (via isql and with nodejs) with odbc debug enabled.

  • running with isql the log contains a message:

[ODBC][47379][1679320146.155152][SQLAllocHandle.c][395]
Entry:
Handle Type = 2
Input Handle = 0x7f987c815200
UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UCS-2-INTERNAL'

  • running through nodejs the log contains the following message:

[ODBC][46268][1679319075.820124][SQLAllocHandle.c][395]
Entry:
Handle Type = 2
Input Handle = 0x7f8a88012600
UNICODE Using encoding ASCII 'US-ASCII' and UNICODE 'UCS-2-INTERNAL'

It seems that the locale settings are not applied when connecting via NodeJS odbc to the driverManager.
The locale settings are:

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

主要语言
JavaScript
星标
159
派生
92
平均合并
5 小时 59 分钟
30 天内合并 PR
3

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

IBM/node-odbc 的其他 Issue

查看 IBM/node-odbc 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。