man-db/man-db-2.6.1-locale-fallback.patch
Peter Schiffer 11f6dece83 - resolves: #833312
update to 2.6.2
- resolves: #657409
  fixed warning when invoking col by the mandb program in cron
- resolves: #829935
  enabled support for man pages compressed with lzip
- resolves: #821778
  added virtual provides for bundled gnulib library
- resolves: #824825
  apropos returns correct exit code for invalid man page
2012-07-10 20:22:20 +02:00

32 lines
956 B
Diff

diff -upr man-db-2.6.1.orig/lib/encodings.c man-db-2.6.1/lib/encodings.c
--- man-db-2.6.1.orig/lib/encodings.c 2011-05-31 02:03:02.000000000 +0200
+++ man-db-2.6.1/lib/encodings.c 2012-06-15 18:32:37.393496286 +0200
@@ -585,14 +585,23 @@ char *find_charset_locale (const char *c
if (STREQ (charset, get_locale_charset ()))
return NULL;
- supported = fopen (supported_path, "r");
- if (!supported)
- return NULL;
-
saved_locale = setlocale (LC_CTYPE, NULL);
if (saved_locale)
saved_locale = xstrdup (saved_locale);
+ supported = fopen (supported_path, "r");
+ if (!supported) {
+ if (strlen (charset) >= (size_t) 5
+ && strncmp (charset, "UTF-8", (size_t) 5) == 0) {
+ locale = "en_US.UTF-8";
+ if (setlocale (LC_CTYPE, locale)) {
+ setlocale (LC_CTYPE, saved_locale);
+ return locale;
+ }
+ }
+ return NULL;
+ }
+
while (getline (&line, &n, supported) >= 0) {
const char *space = strchr (line, ' ');
if (space) {