docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.81k stars 2k forks source link

iconv ASCII//TRANSLIT invalid argument #1495

Open louismariegaborit opened 7 months ago

louismariegaborit commented 7 months ago

With php:8.3-fpm-alpine image, I encountered an error when using iconv with TRANSLIT argument.

echo é | iconv -f UTF-8 -t ASCII//TRANSLIT
iconv: destination charset ASCII//TRANSLIT: Invalid argument

On Ubuntu with iconv 2.35, this command works correctly.

tianon commented 7 months ago

I think this is probably better suited to an Alpine/musl specific forum, as it's not really related to PHP (and is likely more about musl not really having full locale support: https://wiki.musl-libc.org/open-issues)

LaurentGoderre commented 5 months ago

Manually downgrading libiconv seems to solve the issue

Edited:

/var/www/html # apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.12/community/ gnu-libiconv=1.15-r2
OK: 21 MiB in 37 packages
/var/www/html # export LD_PRELOAD=/usr/lib/preloadable_libiconv.so
/var/www/html # echo é | iconv -f UTF-8 -t ASCII//TRANSLIT
'e
louismariegaborit commented 3 months ago

@LaurentGoderre I've tested the downgrade but same result. image

LaurentGoderre commented 3 months ago

I forgot a part to the solution, you also need to use

export LD_PRELOAD=/usr/lib/preloadable_libiconv.so