Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/el3um4s/decode-mdb-strange-chars
A workaround to solve the character decoding problem of .mdb files (MS Access)
https://github.com/el3um4s/decode-mdb-strange-chars
decoder mdb ms-access msaccess npm strange-chars utf-8 utf-8-conversion-tool utf8 utf8-characters utf8-string windows
Last synced: 13 days ago
JSON representation
A workaround to solve the character decoding problem of .mdb files (MS Access)
- Host: GitHub
- URL: https://github.com/el3um4s/decode-mdb-strange-chars
- Owner: el3um4s
- License: mit
- Created: 2022-07-17T17:14:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-09T01:59:20.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T12:53:28.393Z (about 1 month ago)
- Topics: decoder, mdb, ms-access, msaccess, npm, strange-chars, utf-8, utf-8-conversion-tool, utf8, utf8-characters, utf8-string, windows
- Language: TypeScript
- Homepage:
- Size: 356 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Decode MDB Strange Chars
A workaround to solve the character decoding problem of .mdb files (MS Access)
NPM link: [@el3um4s/decode-mdb-strange-chars](https://www.npmjs.com/package/@el3um4s/decode-mdb-strange-chars)
### Install and use the package
To use the package in a project:
```bash
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);
// à
```### API
- `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### Acknowledgments
My problem is reading mdb files even when there are strange characters. This package is meant for [node-mdb](https://github.com/el3um4s/node-mdb). It serves as an intermediate step to convert the characters obtained from [run-vbs](https://github.com/el3um4s/run-vbs). I keep it as a separate package so that I can use it in other projects as well. And, above all, to be able to test it independently and, at the same time, keep the _node-mdb_ code clean.