Merge pull request #18324 from woocommerce/fix/18321
Check for mb_detect_encoding support
This commit is contained in:
commit
1223a676e9
|
@ -365,9 +365,14 @@ abstract class WC_CSV_Exporter {
|
|||
$data = $data ? 1 : 0;
|
||||
}
|
||||
|
||||
$use_mb = function_exists( 'mb_convert_encoding' );
|
||||
$data = (string) urldecode( $data );
|
||||
$encoding = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true );
|
||||
$data = 'UTF-8' === $encoding ? $data : utf8_encode( $data );
|
||||
|
||||
if ( $use_mb ) {
|
||||
$encoding = mb_detect_encoding( $data, 'UTF-8, ISO-8859-1', true );
|
||||
$data = 'UTF-8' === $encoding ? $data : utf8_encode( $data );
|
||||
}
|
||||
|
||||
return $this->escape_data( $data );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue