php icon indicating copy to clipboard operation
php copied to clipboard

iconv ASCII//TRANSLIT invalid argument

Open louismariegaborit opened this issue 1 year ago • 4 comments

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.

louismariegaborit avatar Feb 19 '24 08:02 louismariegaborit

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)

tianon avatar Feb 20 '24 19:02 tianon

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

LaurentGoderre avatar Apr 11 '24 16:04 LaurentGoderre

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

louismariegaborit avatar Jun 24 '24 06:06 louismariegaborit

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

export LD_PRELOAD=/usr/lib/preloadable_libiconv.so

LaurentGoderre avatar Jun 25 '24 13:06 LaurentGoderre