Allow LANG/LC_TYPE with @ symbol
PATCH 1/1 Allow LANG/LC_TYPE with @ symbol
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 <[email protected]> for pointing it to me.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
util/scan/scan.c +7 -6
@@ -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