tags 467249 fixed-upstream thanks On Sun, Feb 24, 2008 at 12:10:35PM +0800, LI Daobing wrote: > 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 */
Thanks for the patch. However, man-db already has a function for canonicalising character set names and so it makes sense to use that instead. I've done this; patch attached. (Also, for future reference, please avoid gratuitously changing whitespace conventions. Very few maintainers will accept that.) === modified file 'docs/ChangeLog' --- docs/ChangeLog 2008-02-29 09:59:48 +0000 +++ docs/ChangeLog 2008-03-01 22:16:04 +0000 @@ -1,3 +1,9 @@ +Sat Mar 1 22:14:43 GMT 2008 Colin Watson <[EMAIL PROTECTED]> + + * src/encodings.c (get_roff_encoding): In the CJK UTF-8 special + case, check the canonicalised encoding in order that locale + specifications such as "zh_CN.utf8" work (Debian bug #467249). + Fri Feb 29 09:59:23 GMT 2008 Colin Watson <[EMAIL PROTECTED]> * autogen.sh: Run autoreconf with -f. === modified file 'src/encodings.c' --- src/encodings.c 2008-01-27 22:52:29 +0000 +++ src/encodings.c 2008-03-01 22:16:04 +0000 @@ -598,14 +598,15 @@ * This is evil, but there's not much that can be done about it * apart from waiting for groff 2.0. */ - if (device && STREQ (device, "utf8") && !get_groff_preconv ()) { + if (device && STREQ (device, "utf8") && !get_groff_preconv () && + STREQ (get_locale_charset (), "UTF-8")) { 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 (STRNEQ (ctype, "ja_JP", 5) || + STRNEQ (ctype, "ko_KR", 5) || + STRNEQ (ctype, "zh_CN", 5) || + STRNEQ (ctype, "zh_HK", 5) || + STRNEQ (ctype, "zh_SG", 5) || + STRNEQ (ctype, "zh_TW", 5)) roff_encoding = "UTF-8"; } #endif /* MULTIBYTE_GROFF */ Thanks, -- Colin Watson [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]