Closed
Description
I'm using php7 alpine image and install iconv extension as follow
RUN docker-php-ext-install pdo pdo_mysql iconv
- Checking iconv installed properly
php -i | grep iconv
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
iconv
iconv support => enabled
iconv implementation => unknown
iconv library version => unknown
iconv.input_encoding => no value => no value
iconv.internal_encoding => no value => no value
iconv.output_encoding => no value => no value
- Create a simple php file to test
<?php
mb_language('Japanese');
mb_internal_encoding('UTF-8');
$file = $argv[1];
$fh = fopen($file, 'r');
if ($fh === false) {
die('Could not open file.');
}
var_dump( stream_get_filters());
$sh = stream_filter_prepend($fh, 'convert.iconv.utf-8/cp932', STREAM_FILTER_READ);
if ($sh === false) {
fclose($fh);
die('Counld not apply stream filter.');
}
while (($line = fgets($fh)) !== false) {
echo $line;
}
fclose($fh);
?>
- Create a test text file
- Running
php test.php test.txt
Warning: stream_filter_prepend(): unable to create or locate filter "convert.iconv.utf-8/cp932" in /dashboard/test.php on line 10
I guess that iconv extension has something wrong with UTF-8 and CP932 encode. I'm using this code for creating japanese csv file.
Metadata
Metadata
Assignees
Labels
No labels