aboutsummaryrefslogtreecommitdiffstats
path: root/community/pdfgrep/no-locale.patch
blob: d450055abe5a3d97f64241fdc142a76752143263 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Don't set locale explicitly. musl supports UTF-8 by default.

With this change pdfgrep fails with:

	terminate called after throwing an instance of 'std::runtime_error'
	  what():  locale::facet::_S_create_c_locale name not valid
	Aborted

Unless LANG is set explicitly.

Alternative solutions:

	* Use the "C" lang instead of the "" lang?
	* Catch the error and ignore it?

diff -upr pdfgrep-2.1.2.orig/src/pdfgrep.cc pdfgrep-2.1.2/src/pdfgrep.cc
--- pdfgrep-2.1.2.orig/src/pdfgrep.cc	2020-09-29 12:33:50.018014326 +0200
+++ pdfgrep-2.1.2/src/pdfgrep.cc	2020-09-29 12:36:39.827698175 +0200
@@ -457,10 +457,12 @@ int main(int argc, char** argv)
 	Options options;
 	init_colors(options.outconf.colors);
 
+#if 0
 	// Set locale to user-preference. If this locale is an UTF-8 locale, the
 	// regex-functions regcomp/regexec become unicode aware, which means
 	// e.g. that '.' will match a unicode character, not a single byte.
 	locale::global(locale(""));
+#endif
 
 	enum re_engine_type {
 		RE_POSIX = 0,