From 714d8cc6bbeffd1a6546c05db6211022ca63db85 Mon Sep 17 00:00:00 2001 From: William JCM Date: Mon, 21 Nov 2022 09:50:43 +0100 Subject: [PATCH] Main: force UTF-8 locale. --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 28595d7..ab82cb2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,6 +25,13 @@ #include "SaveTool/SaveTool.h" int main(int argc, char** argv) { + auto str = std::setlocale(LC_ALL, ".utf-8"); + if(str && !Containers::StringView{str}.hasSuffix(".utf8")) { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", + "Your system doesn't support UTF-8.", nullptr); + return EXIT_FAILURE; + } + #ifndef SAVETOOL_DEBUG_BUILD std::ofstream output{"SaveToolLog.txt", std::ios::trunc|std::ios::out};