From ad9276e987121fb1c1fe1416199b4c7b8d2b8c87 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 13 Apr 2015 11:27:31 -0500
Subject: [PATCH] charset: Consider case-insensitive charset names

Also fix bug where bogus charset names like `iso` were confused with valid
charset names starting with that text, such as `iso-8859-2`.
---
 include/class.charset.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/class.charset.php b/include/class.charset.php
index e3697dd58..aa26cb2cc 100644
--- a/include/class.charset.php
+++ b/include/class.charset.php
@@ -24,16 +24,16 @@ class Charset {
         $match = array();
         switch (true) {
         // Windows charsets - force correct format
-        case preg_match('`^Windows-?(\d+)$`', $charset, $match):
+        case preg_match('`^Windows-?(\d+)$`i', $charset, $match):
             return 'Windows-'.$match[1];
         // ks_c_5601-1987: Korean alias for cp949
-        case preg_match('`^ks_c_5601-1987`', $charset):
+        case preg_match('`^ks_c_5601-1987`i', $charset):
             return 'cp949';
-        case preg_match('`^iso-?(\S+)$`', $charset, $match):
+        case preg_match('`^iso-?(\S+)$`i', $charset, $match):
             return "ISO-".$match[1];
         // Incorrect, bogus, ambiguous or empty charsets
         // ISO-8859-1 is assumed
-        case preg_match('`^(default|x-user-defined|iso|us-ascii)`', $charset):
+        case preg_match('`^(default|x-user-defined|iso|us-ascii)$`i', $charset):
         case preg_match('`^\s*$`', $charset):
             return 'ISO-8859-1';
         }
-- 
GitLab