Message ID | 4DA4E513.4090301@redhat.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
diff --git a/util/scan/scan.c b/util/scan/scan.c --- a/util/scan/scan.c +++ b/util/scan/scan.c @@ -2565,12 +2565,13 @@ int main (int argc, char **argv) if ((charset = getenv("LC_ALL")) || (charset = getenv("LC_CTYPE")) || (charset = getenv ("LANG"))) { - while (*charset != '.' && *charset) - charset++; - if (*charset == '.') - charset++; - if (*charset) - output_charset = charset; + char *p = strchr(charset, '.'); + if (p) { + p++; + p = strtok(p, "@"); + } + if (p) + output_charset = p; else output_charset = nl_langinfo(CODESET); } else
According to IEEE Std 1003.1[1], the common way to specify LANG/LC_TYPE is: language[_territory][.codeset] However, a variant may also be used, like: [language[_territory][.codeset][@modifier]] Change the logic to allow getting the charset also with the extended syntax. [1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html Thanks to Winfield <handygewinnspiel@gmx.de> for pointing it to me. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html