TextDecoder 解码 Uint8Array 时出现问题。(背景资料)
var staring = "hello";
var array = new Uint8Array(2);
array[0]=255;
array[1]=0;
var binary=(new TextDecoder("utf-8")).decode(array)
console.log(binary);
应该给我:hello\xFF\x00
而是给了我:hello\xFD\x00
难道我做错了什么?
TextDecoder 解码 Uint8Array 时出现问题。(背景资料)
var staring = "hello";
var array = new Uint8Array(2);
array[0]=255;
array[1]=0;
var binary=(new TextDecoder("utf-8")).decode(array)
console.log(binary);
应该给我:hello\xFF\x00
而是给了我:hello\xFD\x00
难道我做错了什么?