From 8df3668914951cdcf3f9c6be75e17a8c3d3c12d8 Mon Sep 17 00:00:00 2001 From: waker Date: Wed, 7 Nov 2012 18:15:16 +0100 Subject: fixed skipping utf8 bom in id3v2 COMM fields --- junklib.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'junklib.c') diff --git a/junklib.c b/junklib.c index 5ebfbf1d..8bca1edc 100644 --- a/junklib.c +++ b/junklib.c @@ -2904,8 +2904,17 @@ junk_load_comm_frame (int version_major, playItem_t *it, uint8_t *readptr, int s else { strcpy (comment, value); } + trace ("COMM combined: %s\n", comment); - pl_append_meta (it, "comment", comment); + // skip utf8 BOM (can be produced by iconv FEFF/FFFE) + int l = strlen (comment); + uint8_t bom[] = { 0xEF, 0xBB, 0xBF }; + if (l >= 3 && !memcmp (comment, bom, 3)) { + pl_append_meta (it, "comment", comment+3); + } + else { + pl_append_meta (it, "comment", comment); + } free (descr); return 0; -- cgit v1.2.3