Re: [vdr] [PATCH] Small change to correctly query the systems charset

2007-08-12 Thread Klaus Schmidinger
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.0 +0200
> +++ vdr-1.5.2/vdr.c   2007-05-01 17:05:18.0 +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

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [PATCH] Small change to correctly query the systems charset

2007-05-06 Thread Johannes Stezenbach
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

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [PATCH] Small change to correctly query the systems charset

2007-05-06 Thread Klaus Schmidinger
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.0 +0200
> +++ vdr-1.5.2/vdr.c   2007-05-01 17:05:18.0 +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

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [PATCH] Small change to correctly query the systems charset

2007-05-03 Thread Udo Richter

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:

1. If there is a non-null environment variable LC_ALL, the value of
   LC_ALL is used.
2. 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.
3. 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


___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [PATCH] Small change to correctly query the systems charset

2007-05-01 Thread VDR User

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 mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr