-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-encoding.ps1
More file actions
26 lines (19 loc) · 902 Bytes
/
Copy pathsetup-encoding.ps1
File metadata and controls
26 lines (19 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# PowerShell UTF-8 Encoding Setup Script
# Fix Chinese path and output encoding issues
# Set console output encoding to UTF-8 FIRST
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
# Set PowerShell output encoding
$OutputEncoding = [System.Text.Encoding]::UTF8
# Set code page to UTF-8 (65001)
$null = chcp 65001
# Set environment variables
$env:PYTHONIOENCODING = "utf-8"
$env:LC_ALL = "zh_CN.UTF-8"
# Clear screen to apply encoding changes
Clear-Host
# Output status using English to avoid encoding issues
Write-Host "[SUCCESS] PowerShell encoding has been set to UTF-8" -ForegroundColor Green
Write-Host "Current output encoding: $([Console]::OutputEncoding.EncodingName)" -ForegroundColor Cyan
Write-Host ""
Write-Host "You can now use Chinese characters in paths and commands without encoding issues." -ForegroundColor Yellow