|
1 | 1 | #include <borealis.hpp> |
2 | | -#include <locale> |
3 | 2 | #include <clocale> |
4 | | -#include <cstdlib> |
5 | | -#ifndef _WIN32 |
6 | | -#include <unistd.h> |
7 | | -#endif |
8 | 3 | #ifdef _WIN32 |
9 | 4 | #include <windows.h> |
10 | 5 | #endif |
|
46 | 41 | using namespace brls::literals; // for _i18n |
47 | 42 |
|
48 | 43 | int main(int argc, char* argv[]) { |
49 | | - // Set UTF-8 locale for proper character encoding (fixes Croatian, Arabic, and other Unicode characters) |
50 | | - // This must be done before any file I/O or text operations |
51 | | -#if !defined(__PS4__) && !defined(__PSV__) && !defined(__SWITCH__) |
52 | | - // Set environment variables first |
53 | | - setenv("LC_ALL", "en_US.UTF-8", 1); |
54 | | - setenv("LANG", "en_US.UTF-8", 1); |
55 | | - |
56 | | - try { |
57 | | - // Try to set UTF-8 locale |
58 | | - std::locale::global(std::locale("en_US.UTF-8")); |
59 | | - std::setlocale(LC_ALL, "en_US.UTF-8"); |
60 | | - } catch (...) { |
61 | | - // Fallback: try C.UTF-8 or just UTF-8 |
62 | | - try { |
63 | | - setenv("LC_ALL", "C.UTF-8", 1); |
64 | | - setenv("LANG", "C.UTF-8", 1); |
65 | | - std::locale::global(std::locale("C.UTF-8")); |
66 | | - std::setlocale(LC_ALL, "C.UTF-8"); |
67 | | - } catch (...) { |
68 | | - // On some systems, just set UTF-8 for specific categories |
69 | | - std::setlocale(LC_CTYPE, "UTF-8"); |
70 | | - std::setlocale(LC_ALL, ""); |
71 | | - } |
72 | | - } |
| 44 | + // Set UTF-8 locale for proper character encoding |
| 45 | +#if !defined(__PS4__) && !defined(__PSV__) && !defined(__SWITCH__) && !defined(_WIN32) |
| 46 | + std::setlocale(LC_ALL, "C.UTF-8"); |
73 | 47 | #elif defined(_WIN32) |
74 | | - // Windows: Set UTF-8 code page |
75 | 48 | SetConsoleOutputCP(CP_UTF8); |
76 | 49 | SetConsoleCP(CP_UTF8); |
77 | | - // Also set locale |
78 | 50 | std::setlocale(LC_ALL, ".UTF8"); |
79 | 51 | #endif |
80 | 52 |
|
|
0 commit comments