* [PATCH dvb-apps] Allow LANG/LC_TYPE with @ symbol
@ 2011-04-12 23:49 Mauro Carvalho Chehab
0 siblings, 0 replies; only message in thread
From: Mauro Carvalho Chehab @ 2011-04-12 23:49 UTC (permalink / raw)
To: Linux Media Mailing List; +Cc: wk
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>
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-12 23:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-12 23:49 [PATCH dvb-apps] Allow LANG/LC_TYPE with @ symbol Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox