Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 7 Alpine Image + Iconv Problem #428

Closed
p-le opened this issue May 10, 2017 · 5 comments
Closed

PHP 7 Alpine Image + Iconv Problem #428

p-le opened this issue May 10, 2017 · 5 comments

Comments

@p-le
Copy link

p-le commented May 10, 2017

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.

@p-le p-le closed this as completed May 10, 2017
@p-le p-le reopened this May 10, 2017
@wernight
Copy link

wernight commented Jun 1, 2017

I think it should upgrade to alpine:3.6 as iconv support as been improved (forgot in which version). //TRANSLITERA and //IGNORE are still not implemented though.

@tianon
Copy link
Member

tianon commented Dec 22, 2017

Duplicate of #240. 👍

@tianon tianon closed this as completed Dec 22, 2017
@solody
Copy link

solody commented Jul 31, 2018

so what to do

@tsadiq
Copy link

tsadiq commented Sep 28, 2018

I came for the same question and i guess my answer will be to use debian instead of alpine cause it actually work there 😒

@tsadiq
Copy link

tsadiq commented Sep 28, 2018

This could be helpful tho 😊
#240 (comment)

gfrey added a commit to gfrey/daux.io that referenced this issue Feb 24, 2019
This is related to issues with iconv on alpine linux (see [1]). I
noticed that the content file `tipuesearch_content.json` didn't contain
the sanitized text, but only the boolean `false`. I tracked it down to
the `iconv` call. After migration to the debian docker image it is
working fine. Build was started using `docker run --rm -it -w /build -v
"$PWD":/build daux/daux.io daux generate`.

[1] docker-library/php#428
onigoetz pushed a commit to dauxio/daux.io that referenced this issue Feb 25, 2019
This is related to issues with iconv on alpine linux (see [1]). I
noticed that the content file `tipuesearch_content.json` didn't contain
the sanitized text, but only the boolean `false`. I tracked it down to
the `iconv` call. After migration to the debian docker image it is
working fine. Build was started using `docker run --rm -it -w /build -v
"$PWD":/build daux/daux.io daux generate`.

[1] docker-library/php#428
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants