Hi there!
This patch just changes charset querying to not only look at environment variable LANG, but respect all in correct order. So now I can overwrite charset setting with LC_CTYPE and LC_ALL.
Greetings Matthias
This patch just changes charset querying to not only look at environment variable LANG, but respect all in correct order. So now I can overwrite charset setting with LC_CTYPE and LC_ALL.
Just curious, why would you need to query anything other than the environment LANG variable? If that tells you what the user wants to use, there's no need to look any further. Unless it's empty I guess?
Thanks.
VDR User wrote:
This patch just changes charset querying to not only look at environment variable LANG, but respect all in correct order. So now I can overwrite charset setting with LC_CTYPE and LC_ALL.
Just curious, why would you need to query anything other than the environment LANG variable? If that tells you what the user wants to use, there's no need to look any further. Unless it's empty I guess?
From man 7 locale:
If the second argument to setlocale() is empty string, "", for the default locale, it is determined using the following steps:
If there is a non-null environment variable LC_ALL, the value of LC_ALL is used.
If an environment variable with the same name as one of the cat- egories above exists and is non-null, its value is used for that category.
If there is a non-null environment variable LANG, the value of LANG is used.
In other words, the locale system can be set in environment by three different ways, by setting LANG (lowest precedence), by setting specific language aspects (LC_CTYPE describes just character sets, not sorting, numeric notation, date notation etc), or by setting LC_ALL (highest precedence).
Even if LANG is set, it may not be valid, because other settings can override it. And not on all systems LANG is used to set the locale.
Cheers,
Udo
On 05/01/07 17:12, Matthias Schwarzott wrote:
Hi there!
This patch just changes charset querying to not only look at environment variable LANG, but respect all in correct order. So now I can overwrite charset setting with LC_CTYPE and LC_ALL.
Greetings Matthias
diff -ru vdr-1.5.2-vanilla/vdr.c vdr-1.5.2/vdr.c --- vdr-1.5.2-vanilla/vdr.c 2007-05-01 17:04:45.000000000 +0200 +++ vdr-1.5.2/vdr.c 2007-05-01 17:05:18.000000000 +0200 @@ -493,7 +493,7 @@
// Set the system character table:
- char *LangEnv = getenv("LANG");
- char *LangEnv = setlocale(LC_CTYPE, ""); if (LangEnv) { char *CodeSet = strchr(LangEnv, '.'); if (CodeSet) {
If I make this change and run VDR with
export LANG=de_DE.iso8859-15
I get a NULL pointer from the setlocale(LC_CTYPE, "") call. Only with
export LANG=de_DE.iso8859-1
do I get a non-NULL result. Am I missing something here?
Klaus
On Sun, May 06, 2007 at 11:50:21AM +0200, Klaus Schmidinger wrote:
If I make this change and run VDR with
export LANG=de_DE.iso8859-15
I get a NULL pointer from the setlocale(LC_CTYPE, "") call. Only with
export LANG=de_DE.iso8859-1
do I get a non-NULL result. Am I missing something here?
Maybe you don't have the locale files for iso8859-15 installed? (At least in Debian you can choose to install only a subset of the glibc locale files.)
HTH, Johannes
Klaus Schmidinger wrote:
If I make this change and run VDR with
export LANG=de_DE.iso8859-15
I get a NULL pointer from the setlocale(LC_CTYPE, "") call. Only with
export LANG=de_DE.iso8859-1
do I get a non-NULL result. Am I missing something here?
Do you have a de_DE.iso8859-15 installed? It's called de_DE@euro here (yes, that naming is "a bit" strange).
You can check with "locale -a | grep de" to find the installed locales for "de". If no suitable locale is there, you can use locale-gen (at least on Debian and Gentoo) or localedef to install the missing locale.
Regards... Michael
On 05/01/07 17:12, Matthias Schwarzott wrote:
Hi there!
This patch just changes charset querying to not only look at environment variable LANG, but respect all in correct order. So now I can overwrite charset setting with LC_CTYPE and LC_ALL.
Greetings Matthias
diff -ru vdr-1.5.2-vanilla/vdr.c vdr-1.5.2/vdr.c --- vdr-1.5.2-vanilla/vdr.c 2007-05-01 17:04:45.000000000 +0200 +++ vdr-1.5.2/vdr.c 2007-05-01 17:05:18.000000000 +0200 @@ -493,7 +493,7 @@
// Set the system character table:
- char *LangEnv = getenv("LANG");
- char *LangEnv = setlocale(LC_CTYPE, ""); if (LangEnv) { char *CodeSet = strchr(LangEnv, '.'); if (CodeSet) {
It's been a while since this, and there have been some changes in the meantime.
Can you please check the latest developer version (1.5.7) and see whether this works correctly now?
Klaus