Skip to content

Commit

Permalink
Add cp874 support
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsLeenheer committed Aug 17, 2020
1 parent e6183be commit aeaa1c8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If you don't specify a code page, it will assume you want to print only ASCII ch
.text('简体中文')
.encode()

The following code pages are supported: cp437, cp737, cp850, cp775, cp852, cp855, cp857, cp858, cp860, cp861, cp862, cp863, cp864, cp865, cp866, cp869, cp936, cp949, cp950, cp1252, iso88596, shiftjis, windows1250, windows1251, windows1252, windows1253, windows1254, windows1255, windows1256, windows1257, windows1258.
The following code pages are supported: cp437, cp737, cp850, cp775, cp852, cp855, cp857, cp858, cp860, cp861, cp862, cp863, cp864, cp865, cp866, cp869, cp874, cp936, cp949, cp950, cp1252, iso88596, shiftjis, windows1250, windows1251, windows1252, windows1253, windows1254, windows1255, windows1256, windows1257, windows1258.

### Text

Expand Down
2 changes: 1 addition & 1 deletion dist/esc-pos-encoder.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/esc-pos-encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class EscPosEncoder {
'cp1252': [0x10, false],
'iso88596': [0x16, false],
'shiftjis': [0xfc, true],
'windows874': [0x1e, false],
'windows1250': [0x48, false],
'windows1251': [0x49, false],
'windows1252': [0x47, false],
Expand Down
8 changes: 8 additions & 0 deletions test/esc-pos-encoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ describe('EscPosEncoder', function() {
});
});

describe('codepage(cp874).text(กำลังทดสอบ) - thai', function () {
let result = encoder.codepage('cp874').text('กำลังทดสอบ').encode();

it('should be [ 27, 116, 0, 104, 130, 108, 108, 111 ]', function () {
assert.deepEqual(new Uint8Array([ 27, 116, 30, 161, 211, 197, 209, 167, 183, 180, 202, 205, 186 ]), result);
});
});

describe('codepage(cp936).text(简体中文) - simplified chinese', function () {
let result = encoder.codepage('cp936').text('简体中文').encode();

Expand Down

0 comments on commit aeaa1c8

Please sign in to comment.