12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- 'use strict';
- var encoding = require('../lib/encoding');
- exports['General tests'] = {
- 'From UTF-8 to Latin_1': function (test) {
- var input = 'ÕÄÖÜ',
- expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]);
- test.deepEqual(encoding.convert(input, 'latin1'), expected);
- test.done();
- },
- 'From Latin_1 to UTF-8': function (test) {
- var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc]),
- expected = 'ÕÄÖÜ';
- test.deepEqual(encoding.convert(input, 'utf-8', 'latin1').toString(), expected);
- test.done();
- },
- 'From UTF-8 to UTF-8': function (test) {
- var input = 'ÕÄÖÜ',
- expected = Buffer.from('ÕÄÖÜ');
- test.deepEqual(encoding.convert(input, 'utf-8', 'utf-8'), expected);
- test.done();
- },
- 'From Latin_13 to Latin_15': function (test) {
- var input = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xd0]),
- expected = Buffer.from([0xd5, 0xc4, 0xd6, 0xdc, 0xa6]);
- test.deepEqual(encoding.convert(input, 'latin_15', 'latin13'), expected);
- test.done();
- }
-
- };
|