Skip to content

Commit a46f3aa

Browse files
committed
check for broken iconv setup
1 parent 0443bcf commit a46f3aa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Zip.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,12 +629,14 @@ protected function header2fileinfo($header)
629629
* similar enough. CP437 seems not to be available in mbstring. Lastly falls back to keeping the
630630
* string as is, which is still better than nothing.
631631
*
632+
* On some systems iconv is available, but the codepage is not. We also check for that.
633+
*
632634
* @param $string
633635
* @return string
634636
*/
635637
protected function cpToUtf8($string)
636638
{
637-
if (function_exists('iconv')) {
639+
if (function_exists('iconv') && @iconv_strlen('', 'CP437') !== false) {
638640
return iconv('CP437', 'UTF-8', $string);
639641
} elseif (function_exists('mb_convert_encoding')) {
640642
return mb_convert_encoding($string, 'UTF-8', 'CP850');

0 commit comments

Comments
 (0)