Skip to content

Commit 8e436fc

Browse files
committed
fixed deprecated function
1 parent e20ea31 commit 8e436fc

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/Utils.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,9 @@ public static function toUtf8($content, $charset)
204204
return $content;
205205
}
206206

207-
if (function_exists('iconv_set_encoding')) {
208-
$prev = iconv_get_encoding('all');
209-
iconv_set_encoding('php.input_encoding', $charset);
210-
iconv_set_encoding('php.output_encoding', 'UTF-8');
211-
ob_start('ob_iconv_handler');
212-
echo $content;
213-
$content = ob_get_clean();
214-
iconv_set_encoding('php.input_encoding', $prev['input_encoding']);
215-
iconv_set_encoding('php.output_encoding', $prev['output_encoding']);
207+
$encodings = array_map('strtoupper', mb_list_encodings());
216208

217-
return $content;
218-
}
219-
220-
if (function_exists('mb_convert_encoding')) {
209+
if (in_array($charset, $encodings, true)) {
221210
return mb_convert_encoding($content, 'UTF-8', $charset);
222211
}
223212

0 commit comments

Comments
 (0)