Qt: Changes to ensure UTF-8 encoding on windows.

This commit is contained in:
BearOso 2023-08-10 15:09:05 -05:00
parent 2ea377cba1
commit 9dbb36ead0
3 changed files with 6 additions and 4 deletions

View File

@ -212,7 +212,7 @@ void EmuCanvasOpenGL::loadShaders()
}
else
{
setlocale(LC_NUMERIC, "C");
auto previous_locale = setlocale(LC_NUMERIC, "C");
shader = std::make_unique<GLSLShader>();
if (!shader->load_shader(config->shader.c_str()))
{
@ -220,7 +220,7 @@ void EmuCanvasOpenGL::loadShaders()
using_shader = false;
createStockShaders();
}
setlocale(LC_NUMERIC, "");
setlocale(LC_NUMERIC, previous_locale);
}
}

View File

@ -127,14 +127,14 @@ void EmuCanvasVulkan::tryLoadShader()
if (config->use_shader && !config->shader.empty())
{
shader_chain = std::make_unique<Vulkan::ShaderChain>(context.get());
setlocale(LC_NUMERIC, "C");
auto previous_locale = setlocale(LC_NUMERIC, "C");
current_shader = config->shader;
if (!shader_chain->load_shader_preset(config->shader))
{
printf("Couldn't load shader preset: %s\n", config->shader.c_str());
shader_chain.reset();
}
setlocale(LC_NUMERIC, "");
setlocale(LC_NUMERIC, previous_locale);
}
if (!shader_chain)

View File

@ -5,6 +5,7 @@
#include <QStyle>
#include <QStyleHints>
#include <clocale>
#include <qnamespace.h>
#ifndef _WIN32
@ -16,6 +17,7 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, const char *lpCmdLine,
{
char **argv = nullptr;
int argc = 0;
setlocale(LC_ALL, ".utf8");
#else
int main(int argc, char *argv[])
{