a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
18 lines
601 B
Go
18 lines
601 B
Go
//go:build windows
|
|
|
|
package progress
|
|
|
|
import "syscall"
|
|
|
|
// windowsConsoleUTF8 reports whether the active Windows console output codepage
|
|
// is UTF-8 (65001). Legacy OEM codepages (437, 850, 866, …) — still the cmd.exe
|
|
// default — cannot render the box-drawing / check glyphs, so the caller falls
|
|
// back to ASCII. Uses the kernel32 GetConsoleOutputCP syscall directly to avoid
|
|
// pulling in golang.org/x/sys.
|
|
func windowsConsoleUTF8() bool {
|
|
const cpUTF8 = 65001
|
|
proc := syscall.NewLazyDLL("kernel32.dll").NewProc("GetConsoleOutputCP")
|
|
cp, _, _ := proc.Call()
|
|
return uint32(cp) == cpUTF8
|
|
}
|