Skip to content

Instantly share code, notes, and snippets.

@gMan1990
Last active June 1, 2023 15:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gMan1990/ec91efb2f0071c0c95323ba1f2d3af57 to your computer and use it in GitHub Desktop.
Save gMan1990/ec91efb2f0071c0c95323ba1f2d3af57 to your computer and use it in GitHub Desktop.
Cygwin/MSYS2/Mintty 中文乱码问题解决方案

自己挑一种即可~

  • 【推荐】新开gbk窗口执行你的命令:
mintty -o Locale=zh_CN -o Charset=GBK -e fish &
# -e是打开后执行命令,这里的fish是一个shell,你没用就去掉
chcp.com 65001
# 65001是UTF-8,默认936是gb2312
  • 【推荐】针对这些命令,使用 winpty 进行字符流转换。具体是先安装 winpty ( Git Bash 已自带),然后使用 winpty 执行这类命令($ winpty ping www.v2ex.com )即可正常显示中文。详情见:https://www.v2ex.com/t/236123#r_2627313

    • nmap这个命令其它方式不行
  • 对输出编码转换

ipconfig | iconv -f "GBK" -t "UTF-8"
# 不过tskill不知为啥不行
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment