public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Marco Atzeri <marco.atzeri@gmail.com>
To: cygwin-apps@cygwin.com
Subject: Re: pdfgrep [ITA]
Date: Mon, 17 May 2021 08:28:34 +0200	[thread overview]
Message-ID: <61bdb462-4d6b-7495-1d7c-4435a42a03b2@gmail.com> (raw)
In-Reply-To: <057f01d74ad9$98ee6d40$cacb47c0$@pdinc.us>

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

  reply	other threads:[~2021-05-17  6:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 19:10 Jason Pyeron
2021-05-03 19:21 ` Achim Gratz
2021-05-03 19:28   ` Jason Pyeron
     [not found]   ` <001001d74052$710751c0$5315f540$@pdinc.us>
2021-05-09 18:22     ` Jason Pyeron
2021-05-09 18:58       ` Achim Gratz
2021-05-09 19:54       ` Marco Atzeri
2021-05-09 20:05         ` Marco Atzeri
2021-05-09 21:12           ` Jason Pyeron
2021-05-10  6:35             ` Marco Atzeri
2021-05-12  9:27               ` Marco Atzeri
2021-05-17  5:00           ` Jason Pyeron
2021-05-17  6:28             ` Marco Atzeri [this message]
2021-05-17 19:59         ` Jason Pyeron
2021-05-18  9:10           ` Marco Atzeri
2021-05-18 17:13           ` Achim Gratz
2021-05-18 19:24             ` Jason Pyeron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=61bdb462-4d6b-7495-1d7c-4435a42a03b2@gmail.com \
    --to=marco.atzeri@gmail.com \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).