ID3 JS Unicode ReactJs

124 Views Asked by At

I have a React Project which has input type = "file" This input accepts music files and I get tags with ID3 Js But it returns this.

enter image description here

How can I convert them to normal view

My code:

const tags = await id3.fromFile(file)

console.log(tags)
1

There are 1 best solutions below

0
AmigoJack On

id3.js is able to read ID3v2 frames containing Unicode - see /src/id3Frame.ts line 294 and others.

  • Your screenshot shows artist: "M\u0000�\u0000n\u0000e\u0000 while
  • the GUI program shows Måne (thanks for letting me transcribe everything off pictures).

This means the ID3v2 text frames are in a bad format because

  • the wrong text encoding byte was set (0 or 3 instead of 1 or 2), and/or
  • the program who wrote it did not understand Unicode to begin with: Måne should be encoded
    • \x4d\xe5\x6e\x65 in ISO-8859-1 (encoding #0) = 4 bytes
    • \x00\x4d\x01\xfb\x00\x6e\x00\x65 in UTF-16 BE (encoding #1 or #2, as per 2 prefix bytes for a BOM) = 10 bytes
    • \x4d\x00\xfb\x01\x6e\x00\x65\x00 in UTF-16 LE (encoding #2) = 8 bytes
    • \x4d\xc7\xbb\x6e\x65 in UTF-8 (encoding #3) = 5 bytes

How about giving us a screenshot of the raw bytes of the entire ID3v2 tag from your music file? The first 512 bytes should be enough. Use a hex editor to look at the file. A download link to the whole file or its ID3 tags would be even better. Also search in the hex editor for one of the byte sequences I listed - most likely you're unable to find the right spot by just searching for neskin (avoid anything non-ASCII).