Menu

#2671 (ok 2.11.6) cannot force a language

2.11.5
fixed
1
2013-06-11
2008-04-04
No

mysql version 5.0.45
php 5.2.3
phpmyadmin 2.11.5

if we configure config.inc.php with :
$cfg['Lang'] = 'fr-iso-8859-15';

- expect result :

default langage will be latin1

- actual result (with display_error = E_ALL in php.ini) :

Notice: Undefined index: fr-iso-8859-15 in ..../index.php on line 95

Warning: Cannot modify header information - headers already sent by (output started at ..../index.php:95) in ..../index.php on line 99

if it doesn't break anything i suggest this fix :

in libraries/database_interface.lib.php on line 833

-----------replace----------

// If $lang is defined and we are on MySQL >= 4.1.x,
// we auto-switch the lang to its UTF-8 version(if it exists and user
// didn't force language)
if (!empty($GLOBALS['lang'])
&& (substr($GLOBALS['lang'], -5) != 'utf-8')
&& !isset($GLOBALS['cfg']['Lang'])) {
$lang_utf_8_version =
substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-'))
. '-utf-8';
if (!empty($GLOBALS['available_languages'][$lang_utf_8_version])) {

$GLOBALS['lang'] = $lang_utf_8_version;
$GLOBALS['charset'] = 'utf-8';
define('PMA_LANG_RELOAD', 1);
}
}

// and we remove the non-UTF-8 choices to avoid confusion
if (!defined('PMA_REMOVED_NON_UTF_8')) {
foreach ($GLOBALS['available_languages'] as $each_lang => $dummy) {
if (substr($each_lang, -5) != 'utf-8') {
unset($GLOBALS['available_languages'][$each_lang]);
}
}
define('PMA_REMOVED_NON_UTF_8', 1);
}

--------by-----------

// If $lang is defined and we are on MySQL >= 4.1.x,
// we auto-switch the lang to its UTF-8 version(if it exists and user
// didn't force language)
if (!empty($GLOBALS['lang'])
&& (substr($GLOBALS['lang'], -5) != 'utf-8')
&& !isset($GLOBALS['cfg']['Lang'])) {
$lang_utf_8_version =
substr($GLOBALS['lang'], 0, strpos($GLOBALS['lang'], '-'))
. '-utf-8';
if (!empty($GLOBALS['available_languages'][$lang_utf_8_version])) {

$GLOBALS['lang'] = $lang_utf_8_version;
$GLOBALS['charset'] = 'utf-8';
define('PMA_LANG_RELOAD', 1);
}

        // and we remove the non-UTF-8 choices to avoid confusion
    if \(\!defined\('PMA\_REMOVED\_NON\_UTF\_8'\)\) \{
    foreach \($GLOBALS\['available\_languages'\] as $each\_lang => $dummy\) \{
        if \(substr\($each\_lang, -5\) \!= 'utf-8'\) \{
        unset\($GLOBALS\['available\_languages'\]\[$each\_lang\]\);
        \}
    \}
    define\('PMA\_REMOVED\_NON\_UTF\_8', 1\);
    \}

}

Discussion

  • Marc Delisle

    Marc Delisle - 2008-04-16

    Logged In: YES
    user_id=210714
    Originator: NO

    I cannot see a difference with your proposed replacement code and the original, please point me to the different line(s).

     
  • Marc Delisle

    Marc Delisle - 2008-04-16
    • assigned_to: nobody --> lem9
     
  • Thierry Thierry

    Thierry Thierry - 2008-04-16

    Logged In: YES
    user_id=2054626
    Originator: YES

    in the original code the "if (!defined('PMA_REMOVED_NON_UTF_8'))" is outside the "if (!empty($GLOBALS['lang']) && (substr($GLOBALS['lang'], -5) != 'utf-8') && !isset($GLOBALS['cfg']['Lang']))" statement.

    in the replacement code it is inside.

     
  • Marc Delisle

    Marc Delisle - 2008-04-16
    • priority: 5 --> 1
    • summary: cannot configure for an iso charset, utf8 only works --> (ok 2.11.6) cannot force a language
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2008-04-29
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed