Blob Blame History Raw
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 = xstrdup("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) {