Skip to content

Commit

Permalink
hardening utf conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
padams committed Jan 25, 2022
1 parent badb81d commit 0a43f37
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion owa_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0a43f37

Please sign in to comment.