2.1.0 • Published 2 years ago

@lingcz/utf8 v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@lingcz/utf8

Usage

const utf8 = require('@lingcz/utf8')
const str = 'I love 中国'
const result = utf8.encode(str)
/*
{
  hexStr: '49206c6f766520e4b8ade59bbd',
  buffer: ArrayBuffer {
    [Uint8Contents]: <49 20 6c 6f 76 65 20 e4 b8 ad e5 9b bd>,
    byteLength: 13
  },
  bytes: [
     73,  32, 108, 111, 118,
    101,  32, 228, 184, 173,
    229, 155, 189
  ]
}
*/

const originStr = utf8.decode(result.hexStr)
const originStr = utf8.decode(result.buffer)
const originStr = utf8.decode(result.bytes)

// 'I love 中国'
2.1.0

2 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago