[Gambas-user] Gambas called by Apache does not respect LANG?
bb
adamnt42 at gmail.com
Sun Feb 20 18:03:19 CET 2022
On Sun, 2022-02-20 at 17:30 +0100, Benoît Minisini wrote:
> Le 20/02/2022 à 16:43, Christof Thalhofer a écrit :
> > Hi everybody,
> >
> > I have a problem with Gambas 3.16.3. I'm playing around with a
> > Gambas
> > program called from an Apache webserver via CGI.
> >
> > It contains this piece of code:
> >
> > -----------------------------------------------------------
> > With Response
> > .ContentType = "text/plain; charset=utf-8"
> > .Begin
> > Print Env["LANG"] & " " & Format(Date(2000, 7, 1), "mmmm")
> > .End
> > End With
> > -----------------------------------------------------------
> >
> > which outputs the content of the $LANG environment variable and the
> > formatted string of the month 'July'.
> >
> > But even though Apache started the program with the env variable
> > $LANG
> > set to 'de_DE.UTF-8' it prints wrong:
> >
> > 'de_DE.UTF-8 July'
> >
> > instead of the correct
> >
> > 'de_DE.UTF-8 Juli'
> >
> > What am I doing wrong? Thanks in advance.
> >
> > Alles Gute
> >
> > Christof Thalhofer
> >
>
> I don't know. In the past, both $LANG and $LC_ALL had to be set to
> the
> requested language, but now, at least on my Ubuntu 21.10, only $LANG
> is
> set. To 'fr_FR.UTF-8' on my system. And I have the '$LANGUAGE'
> variable
> set to 'fr' (I don't know why these two variables).
>
> Try to set the '$LANGUAGE' variable, or set '$LC_ALL' to 'de_DE.UTF-
> 8',
> to see if it changes anything.
>
> Regards,
>
Have a look at your /etc/apache?/envars file. (? could be the apache
version number).
Also, $LANG and $LANGUAGE are the old pre-locale variables.
Theoretically these days they should be interchangeable. The LC_ALL,
and all the other LC_ variables are those defined by the locale
utility. AFAIK they are for use in shells, so they may or may not be
used by a program session.
Finally, Christof, you should look at how to set apache to use the
users preferred locale, not the servers locale.
hth
b
More information about the User
mailing list