3.0.0 • Published 8 years ago

legacy-encoding v3.0.0

Weekly downloads
1,438
License
MIT
Repository
github
Last release
8 years ago

legacy-encoding

Support as many legacy encodings as possible

Dependency Status NPM version

Installation

npm install legacy-encoding

Usage

legacy.encode(input, encoding, options)

This function takes a plain text string (the input parameter) and encodes it acording the encoding. The return value is a Buffer.

var legacy = require('legacy-encoding');

var buffer = legacy.encode(text, encoding);

The optional options object and its mode property can be used to set the error mode. For encoding, the error mode can be 'fatal' (the default) or 'html'.

var legacy = require('legacy-encoding');

var buffer = legacy.encode(text, encoding, {
  'mode': 'html'
});
// If `text` contains a symbol that cannot be represented in the encoding,
// instead of throwing an error, it will return an HTML entity for the symbol.

legacy.decode(input, encoding, options)

This function takes a Buffer (the input parameter) and decodes it according to encoding.

var legacy = require('legacy-encoding');

var text = legacy.decode(buffer, encoding);

The optional options object and its mode property can be used to set the error mode. For decoding, the error mode can be 'replacement' (the default) or 'fatal'.

var text = windows1255.decode(buffer, encoding, {
  'mode': 'fatal'
});
// If `encodedData` contains an invalid byte for the encoding,
// instead of replacing it with U+FFFD in the output, an error is thrown.

Supported Encodings

  • 10000
  • 10006
  • 10007
  • 10029
  • 10079
  • 10081
  • 1046
  • 1124
  • 1125
  • 1129
  • 1133
  • 1161
  • 1162
  • 1163
  • 1250
  • 1251
  • 1252
  • 1253
  • 1254
  • 1255
  • 1256
  • 1257
  • 1258
  • 20866
  • 21866
  • 28591
  • 28592
  • 28593
  • 28594
  • 28595
  • 28596
  • 28597
  • 28598
  • 28599
  • 28600
  • 28601
  • 28603
  • 28604
  • 28605
  • 28606
  • 437
  • 737
  • 775
  • 808
  • 850
  • 852
  • 855
  • 856
  • 857
  • 858
  • 860
  • 861
  • 862
  • 863
  • 864
  • 865
  • 866
  • 869
  • 874
  • 922
  • 932
  • 936
  • 949
  • 950
  • ansi_x3.4-1968
  • ansix3.4
  • ansix3.41968
  • ansix3.41986
  • arabic
  • arabic8
  • armscii8
  • ascii
  • ascii8bit
  • asmo-708
  • asmo708
  • base64
  • big5
  • big5hkscs
  • binary
  • celtic
  • celtic8
  • cesu8
  • chinese
  • cn
  • cnbig5
  • cp1046
  • cp1124
  • cp1125
  • cp1129
  • cp1133
  • cp1161
  • cp1162
  • cp1163
  • cp1250
  • cp1251
  • cp1252
  • cp1253
  • cp1254
  • cp1255
  • cp1256
  • cp1257
  • cp1258
  • cp20866
  • cp21866
  • cp28591
  • cp28592
  • cp28593
  • cp28594
  • cp28595
  • cp28596
  • cp28597
  • cp28598
  • cp28599
  • cp28600
  • cp28601
  • cp28603
  • cp28604
  • cp28605
  • cp28606
  • cp367
  • cp437
  • cp737
  • cp775
  • cp808
  • cp819
  • cp850
  • cp852
  • cp855
  • cp856
  • cp857
  • cp858
  • cp860
  • cp861
  • cp862
  • cp863
  • cp864
  • cp865
  • cp866
  • cp869
  • cp874
  • cp922
  • cp932
  • cp936
  • cp949
  • cp950
  • cpgr
  • csascii
  • csbig5
  • cseuckr
  • csgb2312
  • cshproman8
  • csibm1046
  • csibm1124
  • csibm1125
  • csibm1129
  • csibm1133
  • csibm1161
  • csibm1162
  • csibm1163
  • csibm437
  • csibm737
  • csibm775
  • csibm850
  • csibm852
  • csibm855
  • csibm856
  • csibm857
  • csibm858
  • csibm860
  • csibm861
  • csibm862
  • csibm863
  • csibm864
  • csibm865
  • csibm866
  • csibm869
  • csibm922
  • csiso14jisc6220ro
  • csiso58gb231280
  • csiso88596e
  • csiso88596i
  • csiso88598e
  • csiso88598i
  • csisolatin1
  • csisolatin2
  • csisolatin3
  • csisolatin4
  • csisolatin5
  • csisolatin6
  • csisolatin9
  • csisolatinarabic
  • csisolatincyrillic
  • csisolatingreek
  • csisolatinhebrew
  • cskoi8r
  • csksc56011987
  • csmacintosh
  • cspc775baltic
  • cspc850multilingual
  • cspc862latinhebrew
  • cspc8codepage437
  • cspcp852
  • csshiftjis
  • cyrillic
  • dos-874
  • ecma-114
  • ecma-118
  • ecma114
  • ecma118
  • elot928
  • elot_928
  • euc-jp
  • euccn
  • eucjp
  • euckr
  • gb18030
  • gb198880
  • gb2312
  • gb23121980
  • gb231280
  • gbk
  • georgianacademy
  • georgianps
  • greek
  • greek8
  • hebrew
  • hebrew8
  • hex
  • hproman8
  • ibm1046
  • ibm1051
  • ibm1124
  • ibm1125
  • ibm1129
  • ibm1133
  • ibm1161
  • ibm1162
  • ibm1163
  • ibm1168
  • ibm367
  • ibm437
  • ibm737
  • ibm775
  • ibm808
  • ibm819
  • ibm850
  • ibm852
  • ibm855
  • ibm856
  • ibm857
  • ibm858
  • ibm860
  • ibm861
  • ibm862
  • ibm863
  • ibm864
  • ibm865
  • ibm866
  • ibm869
  • ibm878
  • ibm922
  • iso-2022-jp
  • iso-2022-jp-1
  • iso-8859-1
  • iso-8859-11
  • iso-8859-15
  • iso-8859-2
  • iso-8859-3
  • iso-8859-4
  • iso-8859-5
  • iso-8859-6
  • iso-8859-6-e
  • iso-8859-6-i
  • iso-8859-7
  • iso-8859-8
  • iso-8859-8-e
  • iso-8859-8-i
  • iso-8859-9
  • iso-ir-100
  • iso-ir-101
  • iso-ir-109
  • iso-ir-110
  • iso-ir-126
  • iso-ir-127
  • iso-ir-138
  • iso-ir-144
  • iso-ir-148
  • iso2022jp
  • iso646.irv
  • iso646cn
  • iso646jp
  • iso646us
  • iso8859-1
  • iso8859-11
  • iso8859-15
  • iso8859-2
  • iso8859-3
  • iso8859-4
  • iso8859-5
  • iso8859-6
  • iso8859-7
  • iso8859-8
  • iso8859-9
  • iso88591
  • iso885910
  • iso885911
  • iso885913
  • iso885914
  • iso885915
  • iso885916
  • iso88592
  • iso88593
  • iso88594
  • iso88595
  • iso88596
  • iso88597
  • iso88598
  • iso88599
  • iso_8859-1
  • iso_8859-15
  • iso_8859-1:1987
  • iso_8859-2
  • iso_8859-2:1987
  • iso_8859-3
  • iso_8859-3:1988
  • iso_8859-4
  • iso_8859-4:1988
  • iso_8859-5
  • iso_8859-5:1988
  • iso_8859-6
  • iso_8859-6:1987
  • iso_8859-7
  • iso_8859-7:1987
  • iso_8859-8
  • iso_8859-8:1988
  • iso_8859-9
  • iso_8859-9:1989
  • isoceltic
  • isoir100
  • isoir101
  • isoir109
  • isoir110
  • isoir126
  • isoir127
  • isoir138
  • isoir14
  • isoir144
  • isoir148
  • isoir149
  • isoir157
  • isoir166
  • isoir179
  • isoir199
  • isoir203
  • isoir226
  • isoir57
  • isoir58
  • isoir6
  • jis
  • jisc62201969ro
  • jp
  • koi
  • koi8
  • koi8-r
  • koi8_r
  • koi8r
  • koi8ru
  • koi8t
  • koi8u
  • korean
  • ksc5601
  • ksc56011987
  • ksc56011989
  • l1
  • l10
  • l2
  • l3
  • l4
  • l5
  • l6
  • l7
  • l8
  • l9
  • latin1
  • latin10
  • latin2
  • latin3
  • latin4
  • latin5
  • latin6
  • latin7
  • latin8
  • latin9
  • logical
  • mac
  • maccenteuro
  • maccroatian
  • maccyrillic
  • macgreek
  • maciceland
  • macintosh
  • macroman
  • macromania
  • macthai
  • macturkish
  • macukraine
  • msansi
  • msarab
  • mscyrl
  • msee
  • msgreek
  • mshebr
  • mskanji
  • msturk
  • pt154
  • r8
  • rk1048
  • roman8
  • shift_jis
  • shiftjis
  • sjis
  • strk10482002
  • sun_eu_greek
  • tcvn
  • tcvn5712
  • tcvn57121
  • thai
  • thai8
  • tis-620
  • tis620
  • tis620.25291
  • tis620.25330
  • tis6200
  • turkish
  • turkish8
  • ucs-2
  • ucs2
  • unicode
  • unicode11utf8
  • us
  • us-ascii
  • usascii
  • utf-16le
  • utf16
  • utf16be
  • utf16le
  • utf7
  • utf7imap
  • utf8
  • viscii
  • visual
  • win1250
  • win1251
  • win1252
  • win1253
  • win1254
  • win1255
  • win1256
  • win1257
  • win1258
  • win874
  • winbaltrim
  • windows-1250
  • windows-1251
  • windows-1252
  • windows-1253
  • windows-1254
  • windows-1255
  • windows-1256
  • windows-1257
  • windows-1258
  • windows-31j
  • windows-874
  • windows1250
  • windows1251
  • windows1252
  • windows1253
  • windows1254
  • windows1255
  • windows1256
  • windows1257
  • windows1258
  • windows874
  • windows932
  • windows936
  • windows949
  • windows950
  • x-cp1250
  • x-cp1251
  • x-cp1252
  • x-cp1253
  • x-cp1254
  • x-cp1255
  • x-cp1256
  • x-cp1257
  • x-cp1258
  • x-mac-cyrillic
  • x-mac-roman
  • x-mac-ukrainian
  • x-sjis
  • xgbk
  • xroman8
  • xxbig5

License

MIT

codecdecoderdecodingencoderencodinglegacylegacy-encoding100001000610007100291007910081104611241125112911331161116211631250125112521253125412551256125712582086621866285912859228593285942859528596285972859828599286002860128603286042860528606437737775808850852855856857858860861862863864865866869874922932936949950ansi_x3.4-1968ansix3.4ansix3.41968ansix3.41986arabicarabic8armscii8asciiascii8bitasmo-708asmo708base64big5big5hkscsbinarycelticceltic8cesu8chinesecncnbig5cp1046cp1124cp1125cp1129cp1133cp1161cp1162cp1163cp1250cp1251cp1252cp1253cp1254cp1255cp1256cp1257cp1258cp20866cp21866cp28591cp28592cp28593cp28594cp28595cp28596cp28597cp28598cp28599cp28600cp28601cp28603cp28604cp28605cp28606cp367cp437cp737cp775cp808cp819cp850cp852cp855cp856cp857cp858cp860cp861cp862cp863cp864cp865cp866cp869cp874cp922cp932cp936cp949cp950cpgrcsasciicsbig5cseuckrcsgb2312cshproman8csibm1046csibm1124csibm1125csibm1129csibm1133csibm1161csibm1162csibm1163csibm437csibm737csibm775csibm850csibm852csibm855csibm856csibm857csibm858csibm860csibm861csibm862csibm863csibm864csibm865csibm866csibm869csibm922csiso14jisc6220rocsiso58gb231280csiso88596ecsiso88596icsiso88598ecsiso88598icsisolatin1csisolatin2csisolatin3csisolatin4csisolatin5csisolatin6csisolatin9csisolatinarabiccsisolatincyrilliccsisolatingreekcsisolatinhebrewcskoi8rcsksc56011987csmacintoshcspc775balticcspc850multilingualcspc862latinhebrewcspc8codepage437cspcp852csshiftjiscyrillicdos-874ecma-114ecma-118ecma114ecma118elot928elot_928euc-jpeuccneucjpeuckrgb18030gb198880gb2312gb23121980gb231280gbkgeorgianacademygeorgianpsgreekgreek8hebrewhebrew8hexhproman8ibm1046ibm1051ibm1124ibm1125ibm1129ibm1133ibm1161ibm1162ibm1163ibm1168ibm367ibm437ibm737ibm775ibm808ibm819ibm850ibm852ibm855ibm856ibm857ibm858ibm860ibm861ibm862ibm863ibm864ibm865ibm866ibm869ibm878ibm922iso-2022-jpiso-2022-jp-1iso-8859-1iso-8859-11iso-8859-15iso-8859-2iso-8859-3iso-8859-4iso-8859-5iso-8859-6iso-8859-6-eiso-8859-6-iiso-8859-7iso-8859-8iso-8859-8-eiso-8859-8-iiso-8859-9iso-ir-100iso-ir-101iso-ir-109iso-ir-110iso-ir-126iso-ir-127iso-ir-138iso-ir-144iso-ir-148iso2022jpiso646.irviso646cniso646jpiso646usiso8859-1iso8859-11iso8859-15iso8859-2iso8859-3iso8859-4iso8859-5iso8859-6iso8859-7iso8859-8iso8859-9iso88591iso885910iso885911iso885913iso885914iso885915iso885916iso88592iso88593iso88594iso88595iso88596iso88597iso88598iso88599iso_8859-1iso_8859-15iso_8859-1:1987iso_8859-2iso_8859-2:1987iso_8859-3iso_8859-3:1988iso_8859-4iso_8859-4:1988iso_8859-5iso_8859-5:1988iso_8859-6iso_8859-6:1987iso_8859-7iso_8859-7:1987iso_8859-8iso_8859-8:1988iso_8859-9iso_8859-9:1989isocelticisoir100isoir101isoir109isoir110isoir126isoir127isoir138isoir14isoir144isoir148isoir149isoir157isoir166isoir179isoir199isoir203isoir226isoir57isoir58isoir6jisjisc62201969rojpkoikoi8koi8-rkoi8_rkoi8rkoi8rukoi8tkoi8ukoreanksc5601ksc56011987ksc56011989l1l10l2l3l4l5l6l7l8l9latin1latin10latin2latin3latin4latin5latin6latin7latin8latin9logicalmacmaccenteuromaccroatianmaccyrillicmacgreekmacicelandmacintoshmacromanmacromaniamacthaimacturkishmacukrainemsansimsarabmscyrlmseemsgreekmshebrmskanjimsturkpt154r8rk1048roman8shift_jisshiftjissjisstrk10482002sun_eu_greektcvntcvn5712tcvn57121thaithai8tis-620tis620tis620.25291tis620.25330tis6200turkishturkish8ucs-2ucs2unicodeunicode11utf8usus-asciiusasciiutf-16leutf16utf16beutf16leutf7utf7imaputf8visciivisualwin1250win1251win1252win1253win1254win1255win1256win1257win1258win874winbaltrimwindows-1250windows-1251windows-1252windows-1253windows-1254windows-1255windows-1256windows-1257windows-1258windows-31jwindows-874windows1250windows1251windows1252windows1253windows1254windows1255windows1256windows1257windows1258windows874windows932windows936windows949windows950x-cp1250x-cp1251x-cp1252x-cp1253x-cp1254x-cp1255x-cp1256x-cp1257x-cp1258x-mac-cyrillicx-mac-romanx-mac-ukrainianx-sjisxgbkxroman8xxbig5browserify
3.0.0

8 years ago

2.0.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago