From 18ffe7c635fe2657fef157cb0192ef6161723d49 Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 12 Dec 2010 21:22:51 +0100 Subject: junklib: skip utf8 bom after converting TXX strings --- junklib.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'junklib.c') diff --git a/junklib.c b/junklib.c index 254f9942..326e5bdf 100644 --- a/junklib.c +++ b/junklib.c @@ -2492,6 +2492,13 @@ junk_id3v2_load_txx (int version_major, playItem_t *it, uint8_t *readptr, int sy } if (val) { + // skip utf8 BOM (can be produced by iconv FEFF/FFFE) + int l = strlen (val); + uint8_t bom[] = { 0xEF, 0xBB, 0xBF }; + if (l >= 3 && !memcmp (val, bom, 3)) { + val += 3; + } + if (!strcasecmp (txx, "replaygain_album_gain")) { it->replaygain_album_gain = atof (val); } @@ -2514,6 +2521,7 @@ junk_id3v2_load_txx (int version_major, playItem_t *it, uint8_t *readptr, int sy pl_replace_meta (it, "year", val); } } + free (txx); return 0; -- cgit v1.2.3