Skip to content

iconv on Alpine 3.13 #1121

Closed
Closed
@enumag

Description

@enumag

Using the PHP alpine images, this code...:

<?php
ini_set('display_errors', '1');
error_reporting(-1);
iconv("UTF-8", "ASCII//TRANSLIT", "foobar");

...causes this error:

iconv(): Wrong charset, conversion from `UTF-8' to `ASCII//TRANSLIT' is not allowed in [...]

This is a long-known issue, however the situation has changed significantly so I think a new issue is appropriate.

Until now the problem was commonly solved by this workaround:

RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ gnu-libiconv
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so

This however no longer works with gnu-libiconv 1.16-r0 because the preloadable_libiconv.so has been removed (see alpine aports issue and related libiconv commit).

On Alpine 3.12 we can use gnu-libiconv=1.15-r2.

On Alpine 3.13 however the version no longer exists and consequently the workaround is not available.

EDIT: My bad. The version is available in 3.13, just missing in edge.

Is there any other way to fix this? Perhaps somehow using --with-iconv when building PHP? (Not sure, just an idea.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions