File tree Expand file tree Collapse file tree 1 file changed +2
-13
lines changed
Expand file tree Collapse file tree 1 file changed +2
-13
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments