USING:
OpenBSD 3.8 GENERIC
APACHE 1.3.29 OPENBSD GENERIC
PHP 5.0.4 OPENBSD PACKAGE
SQUIRRELMAIL 1.4.6, 1.4.5
(previously 1.4.4 works well)
syntom: Language selected in option not work, and
defaults to english in all cases.
problem:
setlocale function used in i18n.php, reply is wrong.
$ret says 'C/es_ES.ISO8859-1/C/C/C/C' instead
of 'es_ES.ISO8859-1'
probably is a php or openbsd problem
resolution:
at function sq_setlocale($category,$locale)
...
$ret=setlocale
$category,$locale);
//***** NEW ******
$ret=str_replace('/C','',str_replace
('C/','',$ret));
//**** END NEW ***
....
ALL WORK OK!!!!
Logged In: YES
user_id=225877
according to PHP manual setlocale call should return false,
if it fails.
setlocale calls always fail on OpenBSD. PHP or OpenBSD
should not return string on failed setlocale() call.
Logged In: YES
user_id=1446988
>> setlocale calls always fail on OpenBSD
nope...
From OpenBSD Manual: 3.8 New Features:
...<B>partial support for loccale</b>...
Logged In: YES
user_id=225877
man 3 setlocale
----
RETURN VALUES
The setlocale() function returns NULL and fails to change
the locale if the given combination of category and locale
makes no sense. The localeconv() function returns a
pointer to a static object which may be altered by later
calls to setlocale() or localeconv().
BUGS
The current implementation supports only the "C" and "POSIX"
locales for all but the LC_CTYPE locale.
----
SquirrelMail uses LC_ALL category. It should return NULL.
Yes. setlocale(LC_ALL,'any-valid-or-invalid-locale-name')
fails on OpenBSD. You need environment variables in order to
make gettext work. Tested on SourceForge OpenBSD host. If
php scripts use only setlocale call, gettext extension does
not search for any gettext message catalog.
Even if OpenBSD implemented some locale support, it is not
working and returns unexpected values. OpenBSD 3.8 is the
first OS, that returns list of all locale categories in php
setlocale() call.
Try using openbsd-current. According to discussion on
#openbsd irc channel, they fixed it in current branch.
If you think that setlocale is working, make sure that it
works in safe_mode or when putenv calls are disabled.
Your changes only remove some output specific to OpenBSD.
You are simulating successful setlocale() call.
Logged In: YES
user_id=225877
SquirrelMail 1.5.2cvs and 1.4.7cvs implemented workarounds
that fix this issue.
Invalid OpenBSD setlocale behavior was reported to
misc@openbsd.org and OpenBSD irc channel. Report was ignored
by OpenBSD developers. Please contact OpenBSD devels and ask
them to fix their code. They are violating own manual.
--- setlocale-test.c ---
#include <stdio.h>
#include <locale.h>
int main(void) {
char *retval;
retval = setlocale(LC_ALL, "en_US.ISO8859-1");
printf("%s",retval);
}
---