Utf8 powershell 程序 终端 需要综合调通。

Problem

What problem does this solve?

终端要自己把vscode调整为utf8程序才不会在终端里打印乱码

Qoder调用Powershell脚本爱写中文注释然后保存为utf8不带BOM,然后这样终端调用powershell脚本就会显示乱码Qoder不认识,然后用脚本改项目代码容易搞坏。

需要powershell脚本是带BOM的utf8编码文件、项目程序是c# core,调通一下吧。

要教Qoder带BOM,但是它经常忘。

Use Case

这几天,改c#项目带有大量中文多行字符串,里面遇到引号,无论是中文还是英文引号,很容易导致代码乱改。

Priority

  • :yellow_circle: Medium - Important improvement

Additional Info

# UTF-8 Encoding Initialization

# 在所有脚本开头调用: . “$PSScriptRoot/init-encoding.ps1”

# 设置控制台编码

[Console]::OutputEncoding = [System.Text.Encoding]::UTF8

$OutputEncoding = [System.Text.Encoding]::UTF8

# 设置环境变量

$env:LC_ALL = ‘C.UTF-8’

$env:LANG = ‘zh_CN.UTF-8’

# 设置代码页(Windows)

if ($IsWindows -or $PSVersionTable.PSVersion.Major -lt 6) {

chcp 65001 | Out-Null

}

# 设置Git编码

git config --global core.quotepath false 2>&1 | Out-Null

git config --global i18n.commitencoding utf-8 2>&1 | Out-Null

git config --global i18n.logoutputencoding utf-8 2>&1 | Out-Null

感谢反馈,我们内部提交需求单,评估和分析下这个问题 :saluting_face: