Verified Commit dcfd0488 authored by Dave Long's avatar Dave Long
Browse files

Issue #1561214 by mfb, sun, fietserwin, drzraf, sdrycroft, nicxvan: Bootstrap...

Issue #1561214 by mfb, sun, fietserwin, drzraf, sdrycroft, nicxvan: Bootstrap sets C locale, but does not set UTF-8 character encoding

(cherry picked from commit 79eed4ac)
parent 72da8154
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for core/lib/Drupal/Core/DrupalKernel.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -1072,7 +1072,7 @@ public static function bootEnvironment($app_root = NULL) {

    // Set sane locale settings, to ensure consistent string, dates, times and
    // numbers handling.
    setlocale(LC_ALL, 'C');
    setlocale(LC_ALL, 'C.UTF-8', 'C');

    // Set appropriate configuration for multi-byte strings.
    mb_internal_encoding('utf-8');
+15 −0
Changes for core/tests/Drupal/KernelTests/Core/DrupalKernel/DrupalKernelTest.php: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@
use Prophecy\Argument;
use Symfony\Component\HttpFoundation\Request;

// cspell:ignore äöüßαβγδεζηθικλμνξοσὠ

/**
 * Tests DIC compilation to disk.
 *
@@ -295,4 +297,17 @@ public function testResetContainer() {
    $this->assertSame($request_stack, $container->get('request_stack'));
  }

  /**
   * Tests system locale.
   */
  public function testLocale(): void {
    $utf8_string = 'äöüßαβγδεζηθικλμνξοσὠ';
    // Test environment locale should be UTF-8.
    $this->assertSame($utf8_string, escapeshellcmd($utf8_string));
    $request = Request::createFromGlobals();
    $kernel = $this->getTestKernel($request);
    // Kernel environment locale should be UTF-8.
    $this->assertSame($utf8_string, escapeshellcmd($utf8_string));
  }

}
+1 −1
Changes for core/tests/bootstrap.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ class_alias('\Drupal\Tests\DocumentElement', '\Behat\Mink\Element\DocumentElemen
// Set sane locale settings, to ensure consistent string, dates, times and
// numbers handling.
// @see \Drupal\Core\DrupalKernel::bootEnvironment()
setlocale(LC_ALL, 'C');
setlocale(LC_ALL, 'C.UTF-8', 'C');

// Set appropriate configuration for multi-byte strings.
mb_internal_encoding('utf-8');