A workaround to solve the character decoding problem of .mdb files (MS Access)
npm install @el3um4s/decode-mdb-strange-charsbash
npm i @el3um4s/decode-mdb-strange-chars
`
and then in a file:
`ts
import {
decodeString,
decodeVBSBuffer,
} from "@el3um4s/decode-mdb-strange-chars";
import { vbs } from "./sql";
const file = path.resolve("./src/__tests__/test.mdb");
const sqlString = SELECT * FROM [test] WHERE [ordine]=${ordine};;
const result = await runVbsBuffer({
vbs,
args: [file, "${sqlString}", type],
});
const decoded = decodeVBSBuffer(result);
console.log(decoded);
// {"result":[{"ordine": "157","carattere": "à","utf-8 bytes": "c3 a0","descrizione": "LATIN SMALL LETTER A WITH GRAVE","codice win": "85"}]}
const codeAccess = "85";
const decodedChar = decodeString(codeAccess);
console.log(decodedChar);
// à
`
$3
- decodeString(text: string): string decode a string of hex code to a string of characters
- decodeVBSBuffer(buffer: string[]): string` decode a buffer of hex code to a string of characters