From 0a43f37932542340405a7b0573b018a0fe215445 Mon Sep 17 00:00:00 2001 From: padams Date: Tue, 25 Jan 2022 00:35:23 +0000 Subject: [PATCH] hardening utf conversion. --- owa_lib.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/owa_lib.php b/owa_lib.php index bbe61b67..e9b39749 100644 --- a/owa_lib.php +++ b/owa_lib.php @@ -1069,7 +1069,16 @@ public static function utf8Encode($string) { return $string; } else { if (function_exists('iconv')) { - return iconv(mb_detect_encoding( $string ),'UTF-8//TRANSLIT', $string); + + if ( function_exists( 'mb_detect_encoding' ) ) { + + return iconv(mb_detect_encoding( $string ),'UTF-8//TRANSLIT', $string); + + } else { + + return iconv('UTF-8','UTF-8//TRANSLIT', $string); + } + } else { // at least worth a try return utf8_encode($string);