Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iconv 调用报错 #414

Closed
imcsd opened this issue Aug 7, 2021 · 3 comments
Closed

iconv 调用报错 #414

imcsd opened this issue Aug 7, 2021 · 3 comments

Comments

@imcsd
Copy link

imcsd commented Aug 7, 2021

执行代码:

$fileName = iconv('UTF-8', 'gb2312', $fileName);

报错:

iconv(): Wrong charset, conversion from UTF-8' to gb2312' is not allowed

查了一下,据说是iconvlib版本太低,参考:docker-library/php#240

但是看了一下dockerfile,已经针对该问题进行处理,但是我这边还是出现上面的报错。

查看PHPinfo,显示:

iconv support | enabled
iconv implementation | unknown
iconv library version | unknown

@huanBird
Copy link

这是docker镜像没有这个扩展吧。可以百度一下,镜像安装这个扩展的

@huadiji
Copy link

huadiji commented Aug 18, 2021

因为新版本的libiconv移除了preloadable_libiconv.so这个扩展包,
进入php容器,执行下面语句,然后重启容器即可
apk add gnu-libiconv=1.15-r2 --no-cache --repository http://mirrors.aliyun.com/alpine/v3.12/community

@uunmask2000
Copy link

因为新版本的libiconv移除了preloadable_libiconv.so这个扩展包, 进入php容器,执行下面语句,然后重启容器即可 apk add gnu-libiconv=1.15-r2 --no-cache --repository http://mirrors.aliyun.com/alpine/v3.12/community

thx

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

No branches or pull requests

5 participants