Code Monkey home page Code Monkey logo

zip-windows's Introduction

zip-windows

解决 Windows 下压缩 zip 包给 Mac 使用时乱码问题的脚本

起因

开发过程中需要设计给予我设计图, 压缩包内很多中文路径导致乱码, Mac 和 Windows 系统之间互传 zip 文件, 打开之后会发现中文名称都是乱码。

Mac 下默认文字编码是 utf-8,而在 Windows 下是 gbk

解决

写一个 Python 脚本, 解决解压缩乱码问题

使用方法: 进入 zip.windows.py 目录, 使用 python zip-windows.py /Users/Yesoul/Downloads/体脂秤.zip

优化

脚本每次都要去我的 iTerm2 上跑很麻烦, 借助工具 Alfred 实现##复制路径##通过 keyword 方式来使用很快捷

query=$1  // 获取参数 也就是路径
path=$1   // 同上
array=(${path//// })  // 将路径通过 / 拆分成一个数组
unset array[${#array[@]}-1]  // 由于路径是要解压的文件路径, 需要拿到解压文件的目录
res=''  // 目录拼接用的结果
for var in ${array[@]}   // 遍历拼接
do
    res=$res'/'$var
done

query=`python zip-windows.py $query` // 执行 Python 脚本
echo -n $query  // 输出成功标志用于通知
open $res  // 打开要解压的文件目录

image

lzzip

zip-windows's People

Contributors

holmeszhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.