From 3a3a8b47220e2a83074b27c06653fcb5666ad554 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Tue, 31 Mar 2015 11:14:51 -0500
Subject: [PATCH] i18n: Ensure UTF-8 is used as the request encoding

---
 bootstrap.php                 | 3 +++
 include/client/header.inc.php | 2 +-
 include/staff/header.inc.php  | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/bootstrap.php b/bootstrap.php
index 41cd7cf4f..145918c87 100644
--- a/bootstrap.php
+++ b/bootstrap.php
@@ -199,6 +199,9 @@ class Bootstrap {
     }
 
     function i18n_prep() {
+        ini_set('default_charset', 'utf-8');
+        ini_set('output_encoding', 'utf-8');
+
         // MPDF requires mbstring functions
         if (!extension_loaded('mbstring')) {
             if (function_exists('iconv')) {
diff --git a/include/client/header.inc.php b/include/client/header.inc.php
index 5d369f63e..14dc65411 100644
--- a/include/client/header.inc.php
+++ b/include/client/header.inc.php
@@ -5,7 +5,7 @@ $signin_url = ROOT_PATH . "login.php"
     . ($thisclient ? "?e=".urlencode($thisclient->getEmail()) : "");
 $signout_url = ROOT_PATH . "logout.php?auth=".$ost->getLinkToken();
 
-header("Content-Type: text/html; charset=UTF-8\r\n");
+header("Content-Type: text/html; charset=UTF-8");
 ?>
 <!DOCTYPE html>
 <html <?php
diff --git a/include/staff/header.inc.php b/include/staff/header.inc.php
index 390987af0..7604e259c 100644
--- a/include/staff/header.inc.php
+++ b/include/staff/header.inc.php
@@ -1,4 +1,6 @@
-<?php if (!isset($_SERVER['HTTP_X_PJAX'])) { ?>
+<?php
+header("Content-Type: text/html; charset=UTF-8");
+if (!isset($_SERVER['HTTP_X_PJAX'])) { ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html <?php
 if (($lang = Internationalization::getCurrentLanguage())
-- 
GitLab