Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#31 OPENBSD wrong locale

closed-fixed
nobody
None
5
2006-04-30
2006-02-08
James Puig
No

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!!!!

Discussion

  • Tomas Kuliavas
    Tomas Kuliavas
    2006-02-09

    • labels: 102907 -->
    • milestone: 102172 -->
     
  • Tomas Kuliavas
    Tomas Kuliavas
    2006-02-09

    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.

     
  • James Puig
    James Puig
    2006-02-21

    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>...

     
  • Tomas Kuliavas
    Tomas Kuliavas
    2006-02-21

    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.

     
  • Tomas Kuliavas
    Tomas Kuliavas
    2006-04-30

    • status: open --> closed-fixed
     
  • Tomas Kuliavas
    Tomas Kuliavas
    2006-04-30

    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);
    }
    ---