Skip to content

Commit

Permalink
🔨 BASE #280 PHP 8.2 nova função utf8_encode
Browse files Browse the repository at this point in the history
  • Loading branch information
bjverde committed Feb 20, 2023
1 parent 56e9540 commit d884019
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions base/classes/helpers/StringHelper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,24 @@ public static function str2utf8($string)
{
if ( mb_detect_encoding($string, 'UTF-8', true)!='UTF-8' ){
//$string= iconv('ISO-8859-1', 'UTF-8', $string);
$string = utf8_encode($string);
//$string = mb_convert_encoding($string, 'UTF-8');
//$string = utf8_encode($string);
$string = mb_convert_encoding($string, 'UTF-8');
}
return $string;
}

/**
* Tranforma um string UTF8 para ISO-8859-1, criada para melhorar compatibilidade com PHP 8.2
*
* @param string $string
* @return string
*/
public static function utf8_encode($string)
{
$string = self::str2utf8($string);
return $string;
}

/**
* Tranforma um string UTF8 para ISO-8859-1, criada para melhorar compatibilidade com PHP 8.2
*
Expand Down

0 comments on commit d884019

Please sign in to comment.