diff options
author | Mario <mario@mariovavti.com> | 2022-10-11 18:18:57 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-10-11 18:18:57 +0000 |
commit | 5e5f0aa955d86743a14531bed98501b59140ab1f (patch) | |
tree | f8a7bbff876adf28d03cc005b8e0a0602886ffc8 /vendor/sabre/vobject/lib/StringUtil.php | |
parent | f9a4c53e3feb07e5319b110b25b4746ae839c420 (diff) | |
download | volse-hubzilla-5e5f0aa955d86743a14531bed98501b59140ab1f.tar.gz volse-hubzilla-5e5f0aa955d86743a14531bed98501b59140ab1f.tar.bz2 volse-hubzilla-5e5f0aa955d86743a14531bed98501b59140ab1f.zip |
update composer libs
Diffstat (limited to 'vendor/sabre/vobject/lib/StringUtil.php')
-rw-r--r-- | vendor/sabre/vobject/lib/StringUtil.php | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/vendor/sabre/vobject/lib/StringUtil.php b/vendor/sabre/vobject/lib/StringUtil.php index 2333d6ab9..b04539e4a 100644 --- a/vendor/sabre/vobject/lib/StringUtil.php +++ b/vendor/sabre/vobject/lib/StringUtil.php @@ -40,23 +40,11 @@ class StringUtil */ public static function convertToUTF8($str) { - $encoding = mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'WINDOWS-1252'], true); - - switch ($encoding) { - case 'ISO-8859-1': - $newStr = utf8_encode($str); - break; - /* Unreachable code. Not sure yet how we can improve this - * situation. - case 'WINDOWS-1252' : - $newStr = iconv('cp1252', 'UTF-8', $str); - break; - */ - default: - $newStr = $str; + if (!mb_check_encoding($str, 'UTF-8') && mb_check_encoding($str, 'ISO-8859-1')) { + $str = mb_convert_encoding($str, 'UTF-8', 'ISO-8859-1'); } // Removing any control characters - return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $newStr); + return preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%', '', $str); } } |