On 17.05.2021 07:00, Jason Pyeron wrote:
-----Original Message-----
From: Marco Atzeri
Sent: Sunday, May 9, 2021 4:05 PM
On 09.05.2021 21:54, Marco Atzeri wrote:
On 09.05.2021 20:22, Jason Pyeron wrote:
$ ./pdfgrep.exe --help
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Aborted (core dumped)
Same for your binary
it seems the program does not like a locale different from C
$ LC_ALL=C bin/pdfgrep.exe
Usage: bin/pdfgrep [OPTION]... PATTERN FILE...
See 'bin/pdfgrep --help' for more information
$ LC_ALL="en_US.UTF-8" bin/pdfgrep.exe
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Aborted (core dumped)
Tracking upstream at: https://gitlab.com/pdfgrep/pdfgrep/-/issues/50
Bug introduced between v1.4.1 and v2.0 in commit
3eb727125f119e1fbc19ba67449838c3f91cd9f6
Author: Hans-Peter Deifel
Date: Tue Jun 21 16:56:30 2016 +0200
Set locale to user preferred one
This enables some unicode awareness in regcomp/regexec if the user has
set a UTF-8 loacle.
Specifically the change was the addition of:
locale::global(locale(""));
also the simple example on
https://en.cppreference.com/w/cpp/locale/locale
$ cat test-locale.cpp
#include <iostream>
#include <locale>
int main()
{
std::wcout << "User-preferred locale setting is " <<
std::locale("").name().c_str() << '\n';
// on startup, the global locale is the "C" locale
std::wcout << 1000.01 << '\n';
// replace the C++ global locale as well as the C locale with the
user-preferred locale
std::locale::global(std::locale(""));
// use the new global locale for future wide character output
std::wcout.imbue(std::locale());
// output the same number again
std::wcout << 1000.01 << '\n';
}
./test-locale.exe
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Aborted (core dumped)
so or the standard is changed or Cygwin implementation has an issue
Regards
Marco