Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fetch encoding once

  • Loading branch information...
commit 9a1ba6861837e46dc2e0a1dcba7a50965e705963 1 parent fecb3c1
Michal Čihař authored April 27, 2012

Showing 1 changed file with 7 additions and 5 deletions. Show diff stats Hide diff stats

  1. 12  libraries/database_interface.lib.php
12  libraries/database_interface.lib.php
@@ -221,6 +221,8 @@ function PMA_DBI_convert_message($message)
221 221
     }
222 222
 
223 223
     if (! empty($server_language) && isset($encodings[$server_language])) {
  224
+        $encoding = $encodings[$server_language];
  225
+
224 226
         if (function_exists('iconv')) {
225 227
             if ((@stristr(PHP_OS, 'AIX'))
226 228
                 && (@strcasecmp(ICONV_IMPL, 'unknown') == 0)
@@ -228,31 +230,31 @@ function PMA_DBI_convert_message($message)
228 230
             ) {
229 231
                 include_once './libraries/iconv_wrapper.lib.php';
230 232
                 $message = PMA_aix_iconv_wrapper(
231  
-                    $encodings[$server_language],
  233
+                    $encoding,
232 234
                     'utf-8' . $GLOBALS['cfg']['IconvExtraParams'],
233 235
                     $message
234 236
                 );
235 237
             } else {
236 238
                 $message = iconv(
237  
-                    $encodings[$server_language],
  239
+                    $encoding,
238 240
                     'utf-8' . $GLOBALS['cfg']['IconvExtraParams'],
239 241
                     $message
240 242
                 );
241 243
             }
242 244
         } elseif (function_exists('recode_string')) {
243 245
             $message = recode_string(
244  
-                $encodings[$server_language] . '..'  . 'utf-8',
  246
+                $encoding . '..'  . 'utf-8',
245 247
                 $message
246 248
             );
247 249
         } elseif (function_exists('libiconv')) {
248  
-            $message = libiconv($encodings[$server_language], 'utf-8', $message);
  250
+            $message = libiconv($encoding, 'utf-8', $message);
249 251
         } elseif (function_exists('mb_convert_encoding')) {
250 252
             // do not try unsupported charsets
251 253
             if (! in_array($server_language, array('ukrainian', 'greek', 'serbian'))) {
252 254
                 $message = mb_convert_encoding(
253 255
                     $message,
254 256
                     'utf-8',
255  
-                    $encodings[$server_language]
  257
+                    $encoding
256 258
                 );
257 259
             }
258 260
         }

0 notes on commit 9a1ba68

Please sign in to comment.
Something went wrong with that request. Please try again.