fix unicode input

This commit is contained in:
John Sennesael 2022-03-19 18:22:46 -05:00
parent 86ed10917d
commit 0d397c20ed
1 changed files with 7 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <iostream>
@ -370,6 +371,12 @@ bool justify(const Settings& settings)
int main(int argc, char* argv[])
{
// Set locale to make unicode input work properly.
const char* langEnv = std::getenv("LANG");
const std::string sysLocale{langEnv ? langEnv : "en_US.utf8"};
std::locale::global(std::locale(sysLocale));
std::vector<std::string> arguments(argv, argv + argc);
Settings settings = parseArgs(arguments);
if (settings.error) return 1;