[Bug] Sybase ASE: Encoding issue (works in msnodesqlv8, fails in node-odbc with \x1A artifacts)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
调研方向
从 node-odbc 查询路径及其 ODBC 列绑定和字符转换处理入手;该 issue 未指定源文件或测试。使用 Adaptive Server Enterprise 或 FreeTDS 驱动程序重现 Sybase ASE 案例,将结果与 msnodesqlv8 进行比较,并在非 ASCII 字符串不再包含 \x1A 残留时认为该 issue 已完成。
由索引模型根据 Issue 内容生成。
描述
Description:
I am using node-odbc to connect to a Sybase ASE database. I am encountering an issue where string data containing special characters or specific encodings is returned with substitute characters (\x1A) or corrupted text.
I have verified that the exact same query and database setup works correctly using msnodesqlv8 package. Since msnodesqlv8 retrieves the correct Unicode/string data within the same Node.js environment, this suggests the issue is specific to how node-odbc is binding the columns (likely defaulting to SQL_C_CHAR when it needs SQL_C_WCHAR or vice versa) or handling the charset conversion from the ODBC driver.
Environment:
OS: Windows 10
ODBC Driver: Adaptive Server Enterprise / FreeTDS
Database: Sybase ASE
Reproduction Steps:
Connect to Sybase ASE using node-odbc.
Select data from a column containing non-ASCII characters.
Observe artifacts (\x1A) in the output.
Run the same query using msnodesqlv8 and observe correct output.
Comparison Code:
const odbc = require('node-odbc');
const sql = require('msnodesqlv8');
const query = "SELECT test_column FROM MyTable WHERE id = 1";
// 1. Test with msnodesqlv8 (Works)
const connectionStringMS = "Driver={...};Server=..."; // Your working connection string
sql.query(connectionStringMS, query, (err, rows) => {
if (err) console.error(err);
console.log('msnodesqlv8 result:', rows);
// Output: Correct String (e.g., "München")
});
// 2. Test with node-odbc (Fails)
async function runOdbc() {
const connection = await odbc.connect('DSN=MySybaseDSN;UID=...;PWD=...');
const result = await connection.query(query);
console.log('node-odbc result:', result);
// Output: Corrupted String (e.g., "München" becomes "M\x1A - \x1A")
}
runOdbc();
Expected Behavior:
node-odbc should return the string correctly, matching the behavior of msnodesqlv8.
Actual Behavior:
node-odbc returns data containing \x1A (SUB) characters. This implies a mismatch in the column binding type (ODBC C-Type) requested by node-odbc versus what the driver provides.
Possible Cause:
It appears node-odbc is not correctly inferring the need for Wide Character binding (SQL_C_WCHAR) for this driver, whereas msnodesqlv8 (via OLE DB) handles the buffer width correctly.
- 主要语言
- JavaScript
- 星标
- 159
- 派生
- 92
- 平均合并
- 5 小时 59 分钟
- 30 天内合并 PR
- 3
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
IBM/node-odbc 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
security
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 38/100
-
enhancement
难度 5/5 一周以上 新手友好度 28/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
rescript-lang/rescript-lang.org#1415 ·
维护者通常 2 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
Deepak3699/Ai_Mentor#244 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
antithesishq/bombadil#361 ·
维护者通常 1 天内回复
-
ungroomed
难度 2/5 1-3 小时 新手友好度 72/100
dequelabs/axe-core#5455 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
DietrichGebert/ponytail#1072 ·
维护者通常 3 天内回复