1.1.0 • Published 2 years ago

gb2312-hex v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

英文字符用ascii编码,中文字符用gb2312编码,并可以16进制互相转换

import { encodeToGb2312HexList, decodeFromGb2312HexList } from 'gb2312-hex';
const txt = `
    我爱你中国...
    Abcd12345.
    拉  ¡  拉
`;
console.log(encodeToGb2312HexList(txt)); 
/* 
 [
  '0A', '20', '20', '20', '20', '20', '20',
  '20', '20', 'CE', 'D2', 'B0', 'AE', 'C4',
  'E3', 'D6', 'D0', 'B9', 'FA', '2E', '2E',
  '2E', '0A', '20', '20', '20', '20', '20',
  '20', '20', '20', '41', '62', '63', '64',
  '31', '32', '33', '34', '35', '2E', '0A',
  '20', '20', '20', '20', '20', '20', '20',
  '20', 'C0', 'AD', '20', '20', '20', '20',
  'C0', 'AD', '0A', '20', '20', '20', '20'
]
*/ 
console.log(decodeFromGb2312HexList(encodeToGb2312HexList(txt)));
/* 

        我爱你中国...
        Abcd12345.
        拉  ¡  拉

*/
1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago