Merge pull request #8004 from jordan-woyak/u8-literal

Fix u8 string literal C++20 compile error.
This commit is contained in:
Pierre Bourdon 2019-04-16 23:43:48 +02:00 committed by GitHub
commit 5c5e6df038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -76,10 +76,13 @@ static std::vector<std::string> ReadM3UFile(const std::string& m3u_path,
std::string line; std::string line;
while (std::getline(s, line)) while (std::getline(s, line))
{ {
if (StringBeginsWith(line, u8"\uFEFF")) // This is the UTF-8 representation of U+FEFF.
const std::string utf8_bom = "\xEF\xBB\xBF";
if (StringBeginsWith(line, utf8_bom))
{ {
WARN_LOG(BOOT, "UTF-8 BOM in file: %s", m3u_path.c_str()); WARN_LOG(BOOT, "UTF-8 BOM in file: %s", m3u_path.c_str());
line.erase(0, 3); line.erase(0, utf8_bom.length());
} }
if (!line.empty() && line.front() != '#') // Comments start with # if (!line.empty() && line.front() != '#') // Comments start with #