summaryrefslogtreecommitdiff
path: root/junklib.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2010-12-12 21:22:51 +0100
committerGravatar waker <wakeroid@gmail.com>2010-12-12 21:22:51 +0100
commit18ffe7c635fe2657fef157cb0192ef6161723d49 (patch)
tree673cc31f2c5834a3445690736139c01e6c394473 /junklib.c
parent8f6c03d93af6501c960360c77fd7540380e535dc (diff)
junklib: skip utf8 bom after converting TXX strings
Diffstat (limited to 'junklib.c')
-rw-r--r--junklib.c8
1 files changed, 8 insertions, 0 deletions
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;