Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

try harder for setting a UTF-8 locale

  • Loading branch information...
commit 773750b77dddaea61c760aca7fde84998723e3da 1 parent f0b6681
Nicolas Grekas authored
5 bootstrapper.php
@@ -19,9 +19,9 @@
19 19 header('Content-Type: text/plain; charset=utf-8'); // Ease with early error messages
20 20 ini_set('html_errors', false); // "
21 21 ini_set('display_errors', true); // "
22   -defined('PATCHWORK_BOOTPATH') || define('PATCHWORK_BOOTPATH', '.');
  22 +defined('PATCHWORK_BOOTPATH') or define('PATCHWORK_BOOTPATH', '.');
23 23
24   -PATCHWORK_BOOTPATH || die('Patchwork error: PATCHWORK_BOOTPATH is empty');
  24 +PATCHWORK_BOOTPATH or die('Patchwork error: PATCHWORK_BOOTPATH is empty');
25 25
26 26 if (file_exists(PATCHWORK_BOOTPATH . '/.patchwork.php'))
27 27 return require PATCHWORK_BOOTPATH . '/.patchwork.php';
@@ -30,7 +30,6 @@
30 30 die("Patchwork error: PHP 5.2.0 or higher is required");
31 31
32 32 error_reporting(E_ALL | E_STRICT);
33   -setlocale(LC_ALL, 'C.UTF-8', 'C');
34 33
35 34 require dirname(__FILE__) . '/core/boot/class/Patchwork/Bootstrapper/Manager.php';
36 35 require dirname(__FILE__) . '/core/boot/class/Patchwork/Bootstrapper.php';
1  core/boot/bootup.patchwork.php
@@ -19,7 +19,6 @@
19 19 ini_set('html_errors', false);
20 20 ini_set('display_errors', true);
21 21 error_reporting(/*<*/E_ALL | E_STRICT/*>*/);
22   -setlocale(LC_ALL, /*<*/setlocale(LC_ALL, 0)/*>*/);
23 22
24 23 // spl_autoload() evades code preprocessing, do not use it
25 24
12 core/utf8/bootup.patchwork.php
@@ -27,6 +27,18 @@
27 27 p\Shim(utf8_decode, s\Xml::utf8_to_cp1252, $s);
28 28
29 29
  30 +// Try to set a UTF-8 compatible locale
  31 +
  32 +/**/$a = setlocale(LC_CTYPE, 'C.UTF-8', 'en_US.UTF-8', 'en_US.utf8', 0);
  33 +
  34 +setlocale(LC_ALL, /*<*/setlocale(LC_CTYPE, 'C.UTF-8', 'C')/*>*/);
  35 +
  36 +/**/if ('C.UTF-8' !== setlocale(LC_CTYPE, 0) && preg_match('/\.UTF-?8$/i', $a))
  37 +/**/{
  38 + setlocale(LC_CTYPE, /*<*/setlocale(LC_CTYPE, $a)/*>*/);
  39 +/**/}
  40 +
  41 +
30 42 // Locale sensitivity breaks UTF-8
31 43
32 44 /**/if ('' === basename('§'))

0 comments on commit 773750b

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