Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

iconv(): Wrong charset, conversion from UTF-8' to ASCII//TRANSLIT//IGNORE' is not allowed #3

Closed
insekticid opened this issue Sep 14, 2017 · 9 comments
Assignees
Labels

Comments

@insekticid
Copy link

How to reproduce?

iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', 'šěýčíéáýřčíšýíščř');

How to fix?

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

refs

@petk petk self-assigned this Sep 14, 2017
@petk petk added the bug label Sep 14, 2017
@nhlm
Copy link
Member

nhlm commented Sep 14, 2017

Fixing a thing by adding a testing channel to the repositories may lead into security issues. Not recommended.

@petk
Copy link
Member

petk commented Sep 18, 2017

I've checked this issue and the fastest and most solid current solution is indeed the one mentioned above. Since the gnu-libiconv package doesn't depend on too many other packages that might break things or present security issues, it's coming to these Dockerfiles in the following commits... So thanks for reporting these issues.

Even better would be to fix PHP core on its way as well. From my tests, currently it is not possible to properly and conveniently build PHP on Alpine with iconv extension using anything other than musl's iconv implementation (which has very strict view on POSIX standards and lacks the iconv's translit).

In such cases another possible solution is to simply use Linux distribution with glibc such as Debian for base Docker image.

@petk
Copy link
Member

petk commented Sep 20, 2017

This has now been fixed via a new gnu-libiconv package in the PHP.earth Alpine repository and patched PHP source code. I'll also send a PR to PHP source code, since the PHP iconv extension is not working as it should and doesn't get built when passing libiconv.

@insekticid
Copy link
Author

tested and it works well

did you sent PR to PHP source code?

@petk
Copy link
Member

petk commented Sep 28, 2017

I'm still preparing the PR for the php-src. For now, there is only a customized patch added to these builds.

@peter279k
Copy link

It looks like this issue has been resolved since php-7.x version.

This issue I think should be closed.

@petk
Copy link
Member

petk commented Jun 9, 2019

Hello, I'm not sure if this has been directly fixed but I suggest moving this to PHP's side altogether - with the iconv different functionality when using the GNU's libiconv and maybe suggesting some sort of warning in the docs or something else that different iconv libraries or implementations mean also different functionalities... I'm not sure. But in any case closing this one as won't fix or at least a partial fix using custom build of GNU libiconv... Thanks.

@petk petk closed this as completed Jun 9, 2019
worstinme added a commit to worstinme/docker-workspace that referenced this issue Apr 11, 2020
@arifulhb
Copy link

arifulhb commented Dec 1, 2020

I've added this code into one of my custom php:7.3.24-fpm-alpine3.12 docker images and that also did work great.

How to reproduce?

iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', 'šěýčíéáýřčíšýíščř');

How to fix?

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

Thanks

@gsusI
Copy link

gsusI commented Sep 11, 2021

Fixed by installing php7-mbstring php7-iconv in that order

RUN apk --no-cache add php7-mbstring php7-iconv

Original solution here: docker-library/php#240 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants