From 4a1e635991a2a51a337387e1e0f615a01592cbed Mon Sep 17 00:00:00 2001 From: lltcggie Date: Wed, 20 Apr 2016 19:02:16 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A8=80=E8=AA=9E=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=81=AEUTF-8=E3=81=AEBOM=E3=81=8C=E3=81=A4=E3=81=84?= =?UTF-8?q?=E3=81=A6=E3=81=84=E3=81=A6=E3=82=82=E5=A4=A7=E4=B8=88=E5=A4=AB?= =?UTF-8?q?=E3=81=AA=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe-gui/LangStringList.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/waifu2x-caffe-gui/LangStringList.h b/waifu2x-caffe-gui/LangStringList.h index f0353a6..1968a66 100644 --- a/waifu2x-caffe-gui/LangStringList.h +++ b/waifu2x-caffe-gui/LangStringList.h @@ -125,7 +125,11 @@ private: jsonBuf[jsonBuf.size() - 1] = '\0'; - d.Parse(jsonBuf.data()); + const char *data = jsonBuf.data(); + if (jsonBuf.size() > 3 && (unsigned char)data[0] == 0xEF && (unsigned char)data[1] == 0xBB && (unsigned char)data[2] == 0xBF) + data += 3; + + d.Parse(data); if (d.HasParseError()) throw 0; @@ -163,9 +167,16 @@ public: LangList.clear(); + bool isFirst = true; + std::string str; while (getline(ifs, str)) { + if (isFirst && str.size() > 3 && (unsigned char)str[0] == 0xEF && (unsigned char)str[1] == 0xBB && (unsigned char)str[2] == 0xBF) + str.erase(0, 3); + + isFirst = false; + if (str.length() > 0 && str.front() == ';') continue;