Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug] Sybase ASE: Encoding issue (works in msnodesqlv8, fails in node-odbc with \x1A artifacts)

オープン
#452 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, node.js
領域
backend, databases

調査の方向性

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
平均マージ
3分
マージ済み PR(30日)
2

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

IBM/node-odbc のほかの issue

IBM/node-odbc の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。