kylekingcdn / music-library-exporter

A lightweight macOS app used to automatically generate (and customize) an Apple Music/iTunes Music Library XML file.
https://music-exporter.app
GNU General Public License v3.0
60 stars 1 forks source link

Strings with Unicode control characters are encoded verbatim #105

Open fwcd opened 6 months ago

fwcd commented 6 months ago

First of all, thanks for this amazing tool! It has proven to be really useful for exporting music libraries e.g. for portable use in the DJ software Mixxx, which has an importer for the iTunes XML format.

Recently, I've tried to export a large library containing some esoteric track titles and came across a small difference between the way this app encodes characters and the XML directly exported from Music.app that Mixxx had trouble parsing. Consider this admittedly unusual title (don't ask me where this came from):

奔剅 Ԁ ㈀㄰吹塘X " 䕒䱐奁䅇义呟䅒䭃䝟䥁Nㄭ⸱〵㈱搠呂剄C ̀〲㤱䍔䵏 ऀ 刃汥慯敄呥偂M ̀㐱吸䕋Y ̀궙

The problematic characters are U+0004 and U+0005 (i.e. Unicode control characters). Music.app seems to remove them while Music Library Exporter preserves them:

Music Library Exporter: <string>奔剅 Ԁ ㈀㄰吹塘X " 䕒䱐奁䅇义呟䅒䭃䝟䥁Nㄭ⸱〵㈱搠呂剄C ̀〲㤱䍔䵏 ऀ 刃汥慯敄呥偂M ̀㐱吸䕋Y ̀궙</string>
Music.app:              <string>奔剅 Ԁ ㈀㄰吹塘X " 䕒䱐奁䅇义呟䅒䭃䝟䥁Nㄭ⸱〵㈱搠呂剄C  ̀〲㤱䍔䵏 ऀ 刃汥慯敄呥偂M  ̀㐱吸䕋Y  ̀궙</string>

Perhaps Music Library Exporter could filter out control characters too to make the file more robust against brittle parsers? (I know this is very much an edge case, but it would still be a nice quality-of-life improvement for large libraries than happen to contain strange characters).