[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');
相关推荐
sunriver200017 天前
【Qt】Qt Creator 19.0.0 编译输出窗口乱码问题
qt·乱码·creator 19.0.0·娉ㄦ
HelloTonyGo21 天前
个人游戏笔记本免费“养龙虾”(四)OpenClaw(exec tools)的文件权限配置
ubuntu·exec·白名单·文件权限·用户权限·openclaw
我在人间贩卖青春1 个月前
SQLite3核心函数与触发器
sqlite·exec·触发器
dozenyaoyida2 个月前
BLE传输WiFi列表的问题分析
网络·经验分享·物联网·wifi·中文乱码·json解析·ble
柏木乃一3 个月前
进程(11)进程替换函数详解
linux·服务器·c++·操作系统·exec
煎饼皮皮侠4 个月前
快速查找应用日志的几个场景
unzip·logback·grep
妙为4 个月前
osgEarth中文显示乱码
中文乱码·osgearth·osg
教练、我想打篮球4 个月前
119 response.setCharacterEncoding(“utf8“) 设置编码之后 编码依然为 ISO-8859-1
乱码·response·encoding
teacherlg5 个月前
Source Insight 乱码问题解决
c++·乱码·编码·sourceinsight
邪恶紫色秋裤6 个月前
解决IntelliJ IDEA控制台输出中文乱码问题
java·ide·乱码·intellij-idea·报错·中文