We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aae0916 commit 5165533Copy full SHA for 5165533
src/Zip.php
@@ -653,9 +653,16 @@ protected function cpToUtf8($string)
653
*/
654
protected function utf8ToCp($string)
655
{
656
+ // try iconv first
657
if (function_exists('iconv')) {
- return iconv('UTF-8', 'CP437//IGNORE', $string);
658
- } elseif (function_exists('mb_convert_encoding')) {
+ $string = @iconv('UTF-8', 'CP437//IGNORE', $string);
659
+ }
660
+ if($string) return $string; // it worked
661
+
662
+ // still here? iconv failed to convert the string. Try another method
663
+ // see http://php.net/manual/en/function.iconv.php#108643
664
665
+ if (function_exists('mb_convert_encoding')) {
666
return mb_convert_encoding($string, 'CP850', 'UTF-8');
667
} else {
668
return $string;
0 commit comments