[Bug] Sybase ASE: Encoding issue (works in msnodesqlv8, fails in node-odbc with \x1A artifacts)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, node.js
Direzione di ricerca
Inizia dal percorso delle query di node-odbc e dalla relativa associazione delle colonne ODBC e gestione della conversione dei caratteri; l’issue non indica alcun file sorgente né alcun test. Riproduci il caso Sybase ASE con il driver Adaptive Server Enterprise o FreeTDS, confronta il risultato con msnodesqlv8 e considera l’issue conclusa quando le stringhe non ASCII non contengono più artefatti \x1A.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- JavaScript
- Stelle
- 158
- Fork
- 92
- Merge medio
- 5h 59m
- PR unite (30g)
- 3
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di IBM/node-odbc
-
doc: how to run the testsAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
-
security
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
Tutte le issue di IBM/node-odbc
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 3 giorni
-
audit.md numbers Theming and Responsive Design differently in the headings and the score tableForse già presa @pbakaus l’ha presa oggi. Apertaneeds triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
pbakaus/impeccable#979 ·
I maintainer di solito rispondono entro 1 giorno
-
area/web interface
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mastodon/mastodon#40924 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
fireEvent.select does not wrap its automatic native focus in actForse già presa @sergioperezcheco l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug user-priority/P2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno