From ee2d3c72ba13a5b1370719da865dd0af89aa3507 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 2 Jun 2016 09:05:19 -0700
Subject: [PATCH] i18n: Ensure UTF-8 locale is set

This is required for system requests such as email piping. Since a user is
not logged in for the request, the system locale will not be set and text
might get corrupted based on the PHP configuration.

Fixes #2910
---
 bootstrap.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/bootstrap.php b/bootstrap.php
index e70c79a6b..996a99498 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -290,6 +290,10 @@ class Bootstrap {
         }
         if (extension_loaded('iconv'))
             iconv_set_encoding('internal_encoding', 'UTF-8');
+
+        // Set the default locale to UTF-8. It will be changed by
+        // ::setLocaleForUser() later for web requests. See #2910
+        Translation::setLocale(LC_ALL, 'en_US.UTF-8');
     }
 
     function croak($message) {
-- 
GitLab