mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 06:47:52 +01:00
Decode hex into utf8 instead of ascii
This commit is contained in:
parent
2e8bd7f32e
commit
2a7b4f9aed
1 changed files with 3 additions and 3 deletions
|
@ -15,11 +15,11 @@ export class Hex2asciiPipe implements PipeTransform {
|
||||||
if (!hex) {
|
if (!hex) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
let str = '';
|
let bytes: number[] = [];
|
||||||
for (let i = 0; i < hex.length; i += 2) {
|
for (let i = 0; i < hex.length; i += 2) {
|
||||||
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
|
bytes.push(parseInt(hex.substr(i, 2), 16));
|
||||||
}
|
}
|
||||||
return str;
|
return new TextDecoder('utf8').decode(Uint8Array.from(bytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue