Skip to content

Proper iconv #240

Closed
Closed
@davidsteinsland

Description

@davidsteinsland

iconv is not working as expected on a vanilla php image. The solution is to install GNUs libiconv:
https://ftp.gnu.org/pub/gnu/libiconv/
... and linking this with php during configure process, or give the GNU library precedence:

ENV LD_PRELOAD /usr/local/lib/preloadable_libiconv.so

In any case, this script should not produce errors (as it does on current php images):

ini_set('display_errors', '1');
error_reporting(-1);

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

Current work-around:

RUN rm /usr/bin/iconv \
  && curl -SL http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | tar -xz -C . \
  && cd libiconv-1.14 \
  && ./configure --prefix=/usr/local \
  && curl -SL https://raw.githubusercontent.com/mxe/mxe/7e231efd245996b886b501dad780761205ecf376/src/libiconv-1-fixes.patch \
  | patch -p1 -u  \
  && make \
  && make install \
  && libtool --finish /usr/local/lib \
  && cd .. \
  && rm -rf libiconv-1.14

ENV LD_PRELOAD /usr/local/lib/preloadable_libiconv.so

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