fix(ps1): strip all non-ASCII Unicode from PowerShell scripts

Windows PowerShell 5.1 reads .ps1 files without BOM as Windows-1251 by
default. Em-dashes (-) and other Unicode chars in string literals get
mangled into invalid bytes (e.g. "session - no" becomes garbage that
breaks the parser with "Unexpected token" errors.

Replaced em-dash, en-dash, smart quotes, ellipsis, NBSP and arrows with
their ASCII equivalents across all 12 .ps1 scripts (install/update/
uninstall for claude/gemini/codex/qwen).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-04-21 10:53:15 +00:00
parent cb088c4e9a
commit 3381797148
12 changed files with 1653 additions and 1653 deletions

View File

@@ -1,4 +1,4 @@
# Claude Code Windows Installer # Claude Code - Windows Installer
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_install.ps1 # Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_install.ps1
# #
# Installs Node.js (if needed), Claude Code via npm registry, configures env vars and settings. # Installs Node.js (if needed), Claude Code via npm registry, configures env vars and settings.

View File

@@ -1,4 +1,4 @@
# Claude Code Windows Uninstaller # Claude Code - Windows Uninstaller
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_uninstall.ps1 # Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_uninstall.ps1
$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"

View File

@@ -1,4 +1,4 @@
# Claude Code Windows Updater # Claude Code - Windows Updater
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_update.ps1 # Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_update.ps1
# #
# Updates Claude Code via npm registry + re-applies config patches. # Updates Claude Code via npm registry + re-applies config patches.

View File

@@ -1,4 +1,4 @@
# Codex CLI Windows Installer # Codex CLI - Windows Installer
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_install.ps1 # Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_install.ps1
# #
# Downloads Codex CLI binary from GitHub, applies config patches. # Downloads Codex CLI binary from GitHub, applies config patches.
@@ -25,7 +25,7 @@ function Refresh-Path {
# ---- Check prerequisites ---- # ---- Check prerequisites ----
# Python 3.11+ (for tomllib) optional, fallback to PowerShell patching # Python 3.11+ (for tomllib) - optional, fallback to PowerShell patching
$pyCmd = $null $pyCmd = $null
foreach ($candidate in @("python3", "python")) { foreach ($candidate in @("python3", "python")) {
if (Test-Command $candidate) { if (Test-Command $candidate) {
@@ -183,7 +183,7 @@ if (Test-Path $staleCatalog) {
# ---- Apply patches ---- # ---- Apply patches ----
if ($pyCmd) { if ($pyCmd) {
# Python available use full patcher # Python available - use full patcher
Write-Host " Downloading patcher..." -ForegroundColor Cyan Write-Host " Downloading patcher..." -ForegroundColor Cyan
$patchDir = Join-Path $env:TEMP "codex-patcher-$(Get-Random)" $patchDir = Join-Path $env:TEMP "codex-patcher-$(Get-Random)"
New-Item -ItemType Directory -Force -Path $patchDir | Out-Null New-Item -ItemType Directory -Force -Path $patchDir | Out-Null
@@ -221,7 +221,7 @@ if ($pyCmd) {
} }
if (-not $pyCmd) { if (-not $pyCmd) {
# PowerShell fallback generate config.toml directly # PowerShell fallback - generate config.toml directly
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
# Codex reads config from ~/.codex/ (NOT %APPDATA%\codex\) # Codex reads config from ~/.codex/ (NOT %APPDATA%\codex\)

View File

@@ -1,4 +1,4 @@
# Codex CLI Windows Uninstaller # Codex CLI - Windows Uninstaller
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_uninstall.ps1 # Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_uninstall.ps1
$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"
@@ -31,7 +31,7 @@ if (Test-Path "$installDir\codex.exe") {
# Check other common locations # Check other common locations
$altPath = (Get-Command codex -ErrorAction SilentlyContinue).Source $altPath = (Get-Command codex -ErrorAction SilentlyContinue).Source
if ($altPath) { if ($altPath) {
Write-Host " Found at: $altPath remove manually" -ForegroundColor Yellow Write-Host " Found at: $altPath - remove manually" -ForegroundColor Yellow
} }
} }

View File

@@ -1,4 +1,4 @@
# Codex CLI Windows Updater # Codex CLI - Windows Updater
# Downloads latest binary from GitHub + re-applies config patches. # Downloads latest binary from GitHub + re-applies config patches.
# #
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_update.ps1 # Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_update.ps1

View File

@@ -1,4 +1,4 @@
# Gemini CLI Windows Installer # Gemini CLI - Windows Installer
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_install.ps1 # Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_install.ps1
# #
# Installs Node.js (if needed), Gemini CLI via npm registry, configures env vars and settings. # Installs Node.js (if needed), Gemini CLI via npm registry, configures env vars and settings.

View File

@@ -1,4 +1,4 @@
# Gemini CLI Windows Uninstaller # Gemini CLI - Windows Uninstaller
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_uninstall.ps1 # Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_uninstall.ps1
$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"

View File

@@ -1,4 +1,4 @@
# Gemini CLI Windows Updater # Gemini CLI - Windows Updater
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_update.ps1 # Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_update.ps1
$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"
@@ -100,7 +100,7 @@ if ($pyCmd) {
} }
if (-not $pyCmd) { if (-not $pyCmd) {
# PowerShell fallback generate settings directly # PowerShell fallback - generate settings directly
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
# Settings # Settings
@@ -137,7 +137,7 @@ if (-not $pyCmd) {
} }
# ---- ALWAYS set env vars in BOTH User scope (persistent) and current session ---- # ---- ALWAYS set env vars in BOTH User scope (persistent) and current session ----
# Critical: gemini reads process.env.GEMINI_API_KEY without setting $env:* here, # Critical: gemini reads process.env.GEMINI_API_KEY - without setting $env:* here,
# `gemini` launched in the same PowerShell will not see the key (setx only updates # `gemini` launched in the same PowerShell will not see the key (setx only updates
# registry; existing processes are not notified). # registry; existing processes are not notified).
Write-Host " Ensuring env vars are set in current session..." -ForegroundColor Cyan Write-Host " Ensuring env vars are set in current session..." -ForegroundColor Cyan
@@ -151,5 +151,5 @@ Write-Host ""
Write-Host " Update complete!" -ForegroundColor Green Write-Host " Update complete!" -ForegroundColor Green
Write-Host "" Write-Host ""
Write-Host " Now you can run: gemini -p `"Hello`"" -ForegroundColor Cyan Write-Host " Now you can run: gemini -p `"Hello`"" -ForegroundColor Cyan
Write-Host " (env vars active in this PowerShell session no restart needed)" -ForegroundColor DarkGray Write-Host " (env vars active in this PowerShell session - no restart needed)" -ForegroundColor DarkGray
Write-Host "" Write-Host ""

View File

@@ -1,4 +1,4 @@
# Qwen Code Windows Installer # Qwen Code - Windows Installer
# Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_install.ps1 # Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_install.ps1
# #
# Installs Node.js (if needed), Qwen Code via npm registry, configures env vars and settings. # Installs Node.js (if needed), Qwen Code via npm registry, configures env vars and settings.
@@ -32,7 +32,7 @@ function Get-NodeMajor {
# ---- Check prerequisites ---- # ---- Check prerequisites ----
# Python3 (optional fallback to PowerShell patching) # Python3 (optional - fallback to PowerShell patching)
$pyCmd = $null $pyCmd = $null
foreach ($candidate in @("python3", "python")) { foreach ($candidate in @("python3", "python")) {
if (Test-Command $candidate) { if (Test-Command $candidate) {
@@ -196,7 +196,7 @@ if ($pyCmd) {
} }
if (-not $pyCmd) { if (-not $pyCmd) {
# PowerShell fallback generate settings directly # PowerShell fallback - generate settings directly
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
# Find qwen settings directory # Find qwen settings directory

View File

@@ -1,4 +1,4 @@
# Qwen Code Windows Uninstaller # Qwen Code - Windows Uninstaller
# Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_uninstall.ps1 # Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_uninstall.ps1
$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"

View File

@@ -1,4 +1,4 @@
# Qwen Code Windows Updater # Qwen Code - Windows Updater
# Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_update.ps1 # Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_update.ps1
$ErrorActionPreference = "Continue" $ErrorActionPreference = "Continue"
@@ -104,7 +104,7 @@ if ($pyCmd) {
} }
if (-not $pyCmd) { if (-not $pyCmd) {
# PowerShell fallback generate settings directly # PowerShell fallback - generate settings directly
Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan Write-Host " Applying patches (PowerShell)..." -ForegroundColor Cyan
# Environment variables # Environment variables