/detect-encoding

Primary LanguageJavaScriptMIT LicenseMIT

detect-encoding

This repo is used to test the encoding detection

Usage

node index.js <file-path> [encoding]

Example

Should print the decoded content of the file

node index.js files/test-utf8-jp.csv utf8
node index.js files/test-utf8-normal.csv utf8
node index.js files/test-utf8-normal.csv sjis
node index.js files/test-shift_jis.csv sjis

Should throw an error due to the wrong encoding

node index.js files/test-utf8-jp.csv sjis
node index.js files/test-shift_jis.csv utf8