From 369771bda5f4dafaf66fdc0931529e9cda92c41d Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Thu, 26 Oct 2023 23:03:54 +0200 Subject: [PATCH] [scan] Handle playlists with Unicode BOM Closes #1674 --- src/library/filescanner_playlist.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/library/filescanner_playlist.c b/src/library/filescanner_playlist.c index ce1d3d0b..c23193dd 100644 --- a/src/library/filescanner_playlist.c +++ b/src/library/filescanner_playlist.c @@ -456,6 +456,10 @@ scan_playlist(const char *file, time_t mtime, int dir_id) { len = strlen(buf); + // Check for and strip byte-order mark + if (memcmp("\xef\xbb\xbf", buf, 3) == 0) + memmove(buf, buf + 3, len - 3 + 1); + // rtrim and check that length is sane (ignore blank lines) while ((len > 0) && isspace(buf[len - 1])) {