[Bug] Sybase ASE: Encoding issue (works in msnodesqlv8, fails in node-odbc with \x1A artifacts)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
Hướng nghiên cứu
Bắt đầu với đường dẫn truy vấn của node-odbc cùng với việc liên kết cột ODBC và xử lý chuyển đổi ký tự; issue không nêu tên tệp nguồn hay bài kiểm thử nào. Tái hiện trường hợp Sybase ASE bằng driver Adaptive Server Enterprise hoặc FreeTDS, so sánh kết quả với msnodesqlv8 và coi issue là hoàn tất khi các chuỗi không phải ASCII không còn chứa các tạo tác \x1A.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- JavaScript
- Star
- 159
- Fork
- 92
- Merge trung bình
- 5 giờ 59 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của IBM/node-odbc
-
doc: how to run the testsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
security
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
Tất cả issue của IBM/node-odbc
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Deepak3699/Ai_Mentor#244 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci-install-db-tools stall-case tests flake: stalled apt-get can be killed before it logs its callĐang mởeffort:low model:light plan planner:opus-5-5 tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug 🐞
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mozilla-mobile/firefox-ios#35986 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hidden loading spinner keeps animating after connect, causing high idle CPU usage in FirefoxĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
bug(sight): the dashboard's text truncations split surrogate pairs and show broken charactersĐang mởcomponent:sight
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
agentic-os-org/ANOLISA#6738 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày