[PHP]解决exec执行unzip出现中文文件名乱码的问题

查看Linux编码,如下图可看出Linux编码是 zh_CN.UTF-8

问题截图

以下代码都会产生乱码

php 复制代码
exex('unzip -d /xxx /x/test.zip');
exex('unzip -O zh_CN.UTF-8 -d /xxx /x/test.zip');
exex('unzip -I zh_CN.UTF-8 -d /xxx /x/test.zip');

解决方法:

php 复制代码
exec('LANG=zh_CN.UTF-8 unzip -d /xxx /x/test.zip');
相关推荐
妙为13 天前
osgEarth中文显示乱码
中文乱码·osgearth·osg
教练、我想打篮球16 天前
119 response.setCharacterEncoding(“utf8“) 设置编码之后 编码依然为 ISO-8859-1
乱码·response·encoding
teacherlg1 个月前
Source Insight 乱码问题解决
c++·乱码·编码·sourceinsight
邪恶紫色秋裤2 个月前
解决IntelliJ IDEA控制台输出中文乱码问题
java·ide·乱码·intellij-idea·报错·中文
daqinzl3 个月前
Ubuntu 24.04 解决 firefox 中文界面乱码
ubuntu·中文乱码·firefox
Pafey4 个月前
VS2022 + Qt5.9 中文乱码/项目设置utf-8编码
c++·qt·中文乱码
Lilixxs4 个月前
VBA 中使用 ADODB 操作 SQLite 插入中文乱码问题
数据库·中间件·sqlite·乱码·vba·odbc·adodb
2401_858286114 个月前
OS26.【Linux】进程程序替换(下)
linux·运维·服务器·开发语言·算法·exec·进程
胡斌附体6 个月前
mobaxterm终端sqlplus乱码问题解决
数据库·乱码·sqlplus·字符集设置
初级代码游戏7 个月前
源码:处理文件格式和字符集的相关代码(3-3)
字符编码·乱码·代码页·unicode·bom·utf·文本格式