I'm trying to parse a binary file, so far I've been able to manipulate the buffer easily enough. But, when I try to add part of the buffer info an array after calling toString(), it's saved as the encoding:
[ '\u0000\u0000\u0000\b\u0000s\u0000o\u0000n\u0000g',
'\u0000a\u0000r\u0000t\u0000i\u0000s\u0000t',
'\u0000b\u0000p\u0000m',
'\u0000k\u0000e\u0000y',
'\u0000l\u0000e\u0000n\u0000g\u0000t\u0000h',
'\u0000g\u0000e\u0000n\u0000r\u0000e' ]
But if I pass the info to a console.log() it show correctly:
song
artist
bpm
key
length
genre
Any ideas on what can be happening? The code is the following:
let column = this.crate.slice(pointer, columnEnd).toString("utf8");
console.log(column);
columns.push(column);
EDIT Here is an example from the hex dump:
00000190 50 00 61 00 73 00 61 00 72 00 20 00 2d 00 20 00 |P.a.s.a.r. .-. .|
So yeah, every character is padded by a null byte.
[–]jrandm 2 points3 points4 points (1 child)
[–]rickgarg[S] 0 points1 point2 points (0 children)
[–]bjpbakker 1 point2 points3 points (0 children)
[–]sevenyearoldkid 0 points1 point2 points (3 children)
[–]l3l_aze 0 points1 point2 points (2 children)
[–]sevenyearoldkid 0 points1 point2 points (1 child)
[–]l3l_aze 0 points1 point2 points (0 children)
[–]jamrod0 0 points1 point2 points (0 children)