[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#467249: man-db: over sensitive on the spell of locale



package man-db
tags 467249 patch
thanks


patch:
$ git diff
diff --git a/src/encodings.c b/src/encodings.c
index 4ad6179..5617741 100644
--- a/src/encodings.c
+++ b/src/encodings.c
@@ -600,12 +600,17 @@ const char *get_roff_encoding (const char
*device, const char *source_encoding)
         */
        if (device && STREQ (device, "utf8") && !get_groff_preconv ()) {
                const char *ctype = setlocale (LC_CTYPE, NULL);
-               if (STREQ (ctype, "ja_JP.UTF-8") ||
-                   STREQ (ctype, "ko_KR.UTF-8") ||
-                   STREQ (ctype, "zh_CN.UTF-8") ||
-                   STREQ (ctype, "zh_HK.UTF-8") ||
-                   STREQ (ctype, "zh_SG.UTF-8") ||
-                   STREQ (ctype, "zh_TW.UTF-8"))
+                if (strlen(ctype) > 6 &&
+                    (strncmp(ctype, "ja_JP.", 6) == 0 ||
+                     strncmp(ctype, "ko_KR.", 6) == 0 ||
+                     strncmp(ctype, "zh_CN.", 6) == 0 ||
+                     strncmp(ctype, "zh_HK.", 6) == 0 ||
+                     strncmp(ctype, "zh_SG.", 6) == 0 ||
+                     strncmp(ctype, "zh_TW.", 6) == 0) &&
+                    (STREQ(ctype+6, "UTF-8") ||
+                     STREQ(ctype+6, "utf-8") ||
+                     STREQ(ctype+6, "UTF8") ||
+                     STREQ(ctype+6, "utf8")))
                        roff_encoding = "UTF-8";
        }
 #endif /* MULTIBYTE_GROFF */
$



-- 
Best Regards,
 LI Daobing


Reply to: