Безопасное преобразование b64 в юникод

This commit is contained in:
serega6531 2020-12-29 14:45:58 +03:00
parent 36fdb69be1
commit fb3637a8b2

View File

@ -47,9 +47,16 @@
},
},
methods: {
atou(b64) {
return decodeURIComponent(escape(atob(b64)));
},
atou(b64) {
const text = atob(b64);
const length = text.length;
const bytes = new Uint8Array(length);
for (let i = 0; i < length; i++) {
bytes[i] = text.charCodeAt(i);
}
const decoder = new TextDecoder();
return decoder.decode(bytes);
},
printPacketFlags(packet) {
let flags = [];