Problems with TextDecoder decoding Uint8Array

404 views Asked by At

Having problems with TextDecoder decoding Uint8Array. (background info)

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);

Should give me: hello\xFF\x00

But instead gives me: hello\xFD\x00

Am i doing something wrong?

0

There are 0 answers