rstemmer / id3edit

🛠 id3edit is a command line tool to edit and debug ID3v2 tags of mp3 files supporting Unicode.
GNU General Public License v3.0
31 stars 4 forks source link

encoding test "Encode UTF-16LE with BOM" fails on MacOS #29

Closed rstemmer closed 10 months ago

rstemmer commented 10 months ago

On MacOS the encoding test "Encode UTF-16LE with BOM" fails.

Reason: I assumed inside the test application that "UTF-16" is implicit UTF-16LE with BOM. Actually it is UTF16 LE or BE with BOM which totally makes sende. MacOS uses UTF16BE while Linux systems I used for testing used UTF16LE.

On MacOS:

echo "test" | iconv -f UTF-8 -t UTF-16 | hexdump -C
# 00000000  fe ff 00 74 00 65 00 73  00 74 00 0a              |...t.e.s.t..|

On Linux:

echo "test" | iconv -f UTF-8 -t UTF-16 | hexdump -C
# 00000000  ff fe 74 00 65 00 73 00  74 00 0a 00              |..t.e.s.t...|

Solution: The test application needs to check for both possible results.

rstemmer commented 10 months ago

Fixed and tested on MacOS and Linux (both x86-64)