diff --git a/README.md b/README.md index a94e544..3a83bdd 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable = require('codepage'); +```js +var cptable = require('codepage'); +``` In the browser: - - +```html + + +``` Alternatively, use the full version in the dist folder: - +```html + +``` The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the `bits/` directory. For example, to include only the Mac codepages: - - - - - - +```html + + + + + + +``` All of the browser scripts define and append to the `cptable` object. To rename the object, edit the `JSVAR` shell variable in `make.sh` and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by `ofmt`: - If `ofmt == 'str'`, return a String where `o.charCodeAt(i)` is the `i`-th byte - If `ofmt == 'arr'`, return an Array of bytes +`cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or +Buffer and returns a JS string. + ## Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The `make.sh` script in the repo can take a manifest and generate JS source. Usage: ```bash -bash make.sh path_to_manifest output_file_name JSVAR +$ bash make.sh path_to_manifest output_file_name JSVAR ``` where @@ -107,7 +118,9 @@ where The manifest file is expected to be a CSV with 3 columns: - ,, +``` +,, +``` If a source is specified, it will try to download the specified file and parse. The file format is expected to follow the format from the unicode.org site. diff --git a/misc/README.md.ascii b/misc/README.md.ascii index f5493f4..5e98d97 100644 --- a/misc/README.md.ascii +++ b/misc/README.md.ascii @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable = require('codepage'); +```js +var cptable = require('codepage'); +``` In the browser: - - +```html + + +``` Alternatively, use the full version in the dist folder: - +```html + +``` The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the `bits/` directory. For example, to include only the Mac codepages: - - - - - - +```html + + + + + + +``` All of the browser scripts define and append to the `cptable` object. To rename the object, edit the `JSVAR` shell variable in `make.sh` and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by `ofmt`: - If `ofmt == 'str'`, return a String where `o.charCodeAt(i)` is the `i`-th byte - If `ofmt == 'arr'`, return an Array of bytes +`cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or +Buffer and returns a JS string. + ## Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The `make.sh` script in the repo can take a manifest and generate JS source. Usage: ```bash -bash make.sh path_to_manifest output_file_name JSVAR +$ bash make.sh path_to_manifest output_file_name JSVAR ``` where diff --git a/misc/README.md.utf16be b/misc/README.md.utf16be index 81b0347..94a42d3 100644 Binary files a/misc/README.md.utf16be and b/misc/README.md.utf16be differ diff --git a/misc/README.md.utf16le b/misc/README.md.utf16le index af535c0..471d185 100644 Binary files a/misc/README.md.utf16le and b/misc/README.md.utf16le differ diff --git a/misc/README.md.utf32be b/misc/README.md.utf32be index f978563..db2dc42 100644 Binary files a/misc/README.md.utf32be and b/misc/README.md.utf32be differ diff --git a/misc/README.md.utf32le b/misc/README.md.utf32le index ec50875..bbda127 100644 Binary files a/misc/README.md.utf32le and b/misc/README.md.utf32le differ diff --git a/misc/README.md.utf7 b/misc/README.md.utf7 index fe6c549..82d2bff 100644 --- a/misc/README.md.utf7 +++ b/misc/README.md.utf7 @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable +AD0 require('codepage')+ADs ++AGAAYABg-js +var cptable +AD0 require('codepage')+ADs ++AGAAYABg In the browser: - +ADw-script src+AD0AIg-cptable.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-cputils.js+ACIAPgA8-/script+AD4 ++AGAAYABg-html ++ADw-script src+AD0AIg-cptable.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-cputils.js+ACIAPgA8-/script+AD4 ++AGAAYABg Alternatively, use the full version in the dist folder: - +ADw-script src+AD0AIg-cptable.full.js+ACIAPgA8-/script+AD4 ++AGAAYABg-html ++ADw-script src+AD0AIg-cptable.full.js+ACIAPgA8-/script+AD4 ++AGAAYABg The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the +AGA-bits/+AGA directory. For example, to include only the Mac codepages: - +ADw-script src+AD0AIg-bits/10000.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10006.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10007.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10029.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10079.js+ACIAPgA8-/script+AD4 - +ADw-script src+AD0AIg-bits/10081.js+ACIAPgA8-/script+AD4 ++AGAAYABg-html ++ADw-script src+AD0AIg-bits/10000.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10006.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10007.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10029.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10079.js+ACIAPgA8-/script+AD4 ++ADw-script src+AD0AIg-bits/10081.js+ACIAPgA8-/script+AD4 ++AGAAYABg All of the browser scripts define and append to the +AGA-cptable+AGA object. To rename the object, edit the +AGA-JSVAR+AGA shell variable in +AGA-make.sh+AGA and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by +AGA-ofmt+AGA: - If +AGA-ofmt +AD0APQ 'str'+AGA, return a String where +AGA-o.charCodeAt(i)+AGA is the +AGA-i+AGA--th byte - If +AGA-ofmt +AD0APQ 'arr'+AGA, return an Array of bytes ++AGA-cptable.utils.decode(CP, data)+AGA accepts a byte String or Array of numbers or +Buffer and returns a JS string. + +ACMAIw Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The +AGA-make.sh+AGA script in the repo can take a manifest and generate JS sour Usage: +AGAAYABg-bash -bash make.sh path+AF8-to+AF8-manifest output+AF8-file+AF8-name JSVAR ++ACQ bash make.sh path+AF8-to+AF8-manifest output+AF8-file+AF8-name JSVAR +AGAAYABg where diff --git a/misc/README.md.utf8 b/misc/README.md.utf8 index a94e544..34021f5 100644 --- a/misc/README.md.utf8 +++ b/misc/README.md.utf8 @@ -13,16 +13,22 @@ which codepages are used. In node: - var cptable = require('codepage'); +```js +var cptable = require('codepage'); +``` In the browser: - - +```html + + +``` Alternatively, use the full version in the dist folder: - +```html + +``` The complete set of codepages is large due to some Double Byte Character Set encodings. A much smaller file that just includes SBCS codepages is provided in @@ -32,12 +38,14 @@ If you know which codepages you need, you can include individual scripts for each codepage. The individual files are provided in the `bits/` directory. For example, to include only the Mac codepages: - - - - - - +```html + + + + + + +``` All of the browser scripts define and append to the `cptable` object. To rename the object, edit the `JSVAR` shell variable in `make.sh` and run the script. @@ -76,6 +84,9 @@ and returns a representation controlled by `ofmt`: - If `ofmt == 'str'`, return a String where `o.charCodeAt(i)` is the `i`-th byte - If `ofmt == 'arr'`, return an Array of bytes +`cptable.utils.decode(CP, data)` accepts a byte String or Array of numbers or +Buffer and returns a JS string. + ## Known Excel Codepages A much smaller script, including only the codepages known to be used in Excel, @@ -96,7 +107,7 @@ The `make.sh` script in the repo can take a manifest and generate JS source. Usage: ```bash -bash make.sh path_to_manifest output_file_name JSVAR +$ bash make.sh path_to_manifest output_file_name JSVAR ``` where