May 17, 2012, 11:19:14 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Become a Bigace 3.0 beta tester
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Setlocale (initsession)  (Read 1332 times)
0 Members and 1 Guest are viewing this topic.
Oleg
Team
Bigace Pro
*****
Posts: 166



WWW
« on: April 11, 2011, 01:54:48 PM »

Set current locale function is not working on some hostings, at least for me, in order to make it work needs to be replaced in /system/libs/init.session.inc.php:371:
Code:
setlocale(LC_ALL, $_sessLang->getFullLocale());
to
Code:
setlocale(LC_ALL, $_sessLang->getFullLocale().'.UTF-8');
Logged

Simplicity is the ultimate sophistication (c)
Kevin
Global Moderator
Bigace Guru
*****
Posts: 3045



WWW
« Reply #1 on: April 12, 2011, 12:26:24 AM »

Hm, according to the PHP docu we could pass multiple locales.
The docu says the first one that matches will be used. So if I pass first the version with utf8 and as sencond parameter the version without utf8 it should work on more hosts (at least on linux systems), right?
Logged

Oleg
Team
Bigace Pro
*****
Posts: 166



WWW
« Reply #2 on: April 12, 2011, 08:23:24 AM »

Yeah, it's right. Then better replace with:
Code:
setlocale(LC_ALL, $_sessLang->getFullLocale(), $_sessLang->getFullLocale().'.UTF8', $_sessLang->getFullLocale().'.UTF-8', 'en_US', 'en_US.UTF8', 'en_US.UTF-8');
Logged

Simplicity is the ultimate sophistication (c)
Kevin
Global Moderator
Bigace Guru
*****
Posts: 3045



WWW
« Reply #3 on: April 12, 2011, 10:53:59 AM »

Here ist the docu for everyone who is interested: http://php.net/manual/de/function.setlocale.php

This is what I will use:
Code:
setlocale(
    LC_ALL,
    $_sessLang->getFullLocale().'.utf8',
    $_sessLang->getFullLocale().'.UTF8',
    $_sessLang->getFullLocale(),
    $_sessLang->getLocale(),
    'en_US.utf8',
    'en_US.UTF8',
    'en_US',
    'en'
);

When the docu is right, then the version with dash 'en_US.utf-8' is wrong but 'en_US.utf8' is correct.
And the UTF-8 version is preferred, so I added it to the first position. Could you retest that on your system with russian?
Logged

Oleg
Team
Bigace Pro
*****
Posts: 166



WWW
« Reply #4 on: April 12, 2011, 11:29:27 AM »

No it's don't work for me. I need "UTF-8", so add it too pease.
Code:
[rubigace@fe101 ~]$ uname -rs
FreeBSD 8.1-RELEASE-p2
[rubigace@fe101 ~]$ locale -a
C
POSIX
af_ZA.ISO8859-1
af_ZA.ISO8859-15
af_ZA.UTF-8
am_ET.UTF-8
be_BY.CP1131
be_BY.CP1251
be_BY.ISO8859-5
be_BY.UTF-8
bg_BG.CP1251
bg_BG.UTF-8
ca_AD.ISO8859-1
ca_AD.ISO8859-15
ca_AD.UTF-8
ca_ES.ISO8859-1
ca_ES.ISO8859-15
ca_ES.UTF-8
ca_FR.ISO8859-1
ca_FR.ISO8859-15
ca_FR.UTF-8
ca_IT.ISO8859-1
ca_IT.ISO8859-15
ca_IT.UTF-8
cs_CZ.ISO8859-2
cs_CZ.UTF-8
da_DK.ISO8859-1
da_DK.ISO8859-15
da_DK.UTF-8
de_AT.ISO8859-1
de_AT.ISO8859-15
de_AT.UTF-8
de_CH.ISO8859-1
de_CH.ISO8859-15
de_CH.UTF-8
de_DE.ISO8859-1
de_DE.ISO8859-15
de_DE.UTF-8
...
It's not right, but all with "UTF-8"
Logged

Simplicity is the ultimate sophistication (c)
Kevin
Global Moderator
Bigace Guru
*****
Posts: 3045



WWW
« Reply #5 on: April 12, 2011, 11:31:25 AM »

Okay, I will add it with dash at well.

Here is my system:
Code:
kevin@kevin-laptop:~$ uname -a
Linux kevin-laptop 2.6.35-23-generic #42~ppa1~loms~maverick-Ubuntu SMP Tue Nov 30 02:35:28 UTC 2010 i686 GNU/Linux
kevin@kevin-laptop:~$ uname -rs
Linux 2.6.35-23-generic
kevin@kevin-laptop:~$ locale -a
C
de_AT.utf8
de_BE.utf8
de_CH.utf8
de_DE.utf8
de_LI.utf8
de_LU.utf8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
POSIX
ru_RU.utf8
ru_UA.utf8
Logged

Oleg
Team
Bigace Pro
*****
Posts: 166



WWW
« Reply #6 on: April 12, 2011, 11:36:32 AM »

It's not my system, but my hosting provider. On my system i have 'utf8'.
PS. It's not small provider, many big companies in Russia use it.
Logged

Simplicity is the ultimate sophistication (c)
Kevin
Global Moderator
Bigace Guru
*****
Posts: 3045



WWW
« Reply #7 on: April 12, 2011, 11:46:26 AM »

This is the currenty setting:
Code:
setlocale(
    LC_ALL,
    $_sessLang->getFullLocale().'.utf8',
    $_sessLang->getFullLocale().'.UTF8',
    $_sessLang->getFullLocale().'.utf-8',
    $_sessLang->getFullLocale().'.UTF-8',
    $_sessLang->getFullLocale(),
    $_sessLang->getLocale(),
    'en_US.utf8',
    'en_US.UTF8',
    'en_US.utf-8',
    'en_US.UTF-8',
    'en_US',
    'en'
);
Let me know if anything is missing!
Logged

Oleg
Team
Bigace Pro
*****
Posts: 166



WWW
« Reply #8 on: April 12, 2011, 12:31:43 PM »

Already have that code Smiley. It's work fine! Thanks!
Logged

Simplicity is the ultimate sophistication (c)
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF | Simple Machines LLC