diff --git a/scripts/start-server.ps1 b/scripts/start-server.ps1 index af9249c..3014089 100644 --- a/scripts/start-server.ps1 +++ b/scripts/start-server.ps1 @@ -11,11 +11,16 @@ param( $ErrorActionPreference = "Stop" -# Go 进程输出 UTF-8。不显式设定的话,中文日志会按控制台的 ANSI 代码页(简中为 -# GBK)解码,显示成乱码——见 #48 启动日志。 +# The Go processes emit UTF-8. Without this the console decodes their output +# using the ANSI code page (936 on Simplified Chinese systems) and every +# non-ASCII log line arrives as mojibake. # -# 只设 [Console]::OutputEncoding 不够:PowerShell 5.1 解码子进程输出时还要看 -# 控制台代码页,所以两个都得改。chcp 的输出丢弃掉,避免多打一行。 +# Setting [Console]::OutputEncoding alone is not enough: PowerShell 5.1 decodes +# child process output by the console code page, so chcp has to change too. +# +# NOTE: keep this file pure ASCII. PowerShell 5.1 reads a .ps1 without a BOM as +# ANSI, and a comment line holding an odd number of UTF-8 high bytes pairs its +# last byte with the newline, swallowing it and commenting out the line below. try { $null = & chcp.com 65001 [Console]::OutputEncoding = [Text.Encoding]::UTF8 @@ -207,8 +212,9 @@ try { Remove-Item Env:MYSQL_PWD -ErrorAction SilentlyContinue } - # 让服务端自己读同一个 config.yaml,取出 syb 凭据等本地配置。 - # 下面的 GOAUTO_* 变量优先级高于文件,所以数据库和端口仍以脚本算出的为准。 + # Let the server read the same config.yaml for local values such as the SYB + # credentials. The GOAUTO_* variables below outrank the file, so the + # database and port stay exactly what this script computed. $env:GOAUTO_CONFIG = $ConfigPath $env:GOAUTO_DB_DRIVER = "mysql" $env:GOAUTO_DB_DSN = "${DatabaseUser}:${plainPassword}@tcp(${DatabaseHost}:${DatabasePort})/${DatabaseName}?charset=utf8mb4&parseTime=True&loc=Local&timeout=5s" diff --git a/scripts/start-web.ps1 b/scripts/start-web.ps1 index 093c1f2..d652a2a 100644 --- a/scripts/start-web.ps1 +++ b/scripts/start-web.ps1 @@ -6,11 +6,16 @@ param( $ErrorActionPreference = "Stop" -# Go 进程输出 UTF-8。不显式设定的话,中文日志会按控制台的 ANSI 代码页(简中为 -# GBK)解码,显示成乱码——见 #48 启动日志。 +# The Go processes emit UTF-8. Without this the console decodes their output +# using the ANSI code page (936 on Simplified Chinese systems) and every +# non-ASCII log line arrives as mojibake. # -# 只设 [Console]::OutputEncoding 不够:PowerShell 5.1 解码子进程输出时还要看 -# 控制台代码页,所以两个都得改。chcp 的输出丢弃掉,避免多打一行。 +# Setting [Console]::OutputEncoding alone is not enough: PowerShell 5.1 decodes +# child process output by the console code page, so chcp has to change too. +# +# NOTE: keep this file pure ASCII. PowerShell 5.1 reads a .ps1 without a BOM as +# ANSI, and a comment line holding an odd number of UTF-8 high bytes pairs its +# last byte with the newline, swallowing it and commenting out the line below. try { $null = & chcp.com 65001 [Console]::OutputEncoding = [Text.Encoding]::UTF8