refactor(windows scripts): remove BOM and improve UTF-8 handling

This commit is contained in:
2026-09-09 15:48:32 -04:00
parent d27bf49c40
commit bdeb9c767a
19 changed files with 148 additions and 89 deletions
+5 -2
View File
@@ -1,4 +1,4 @@
<#
<#
LXS - Browsers and media (Windows)
Description: Browsers and media players installed through winget.
Repo: https://git.hyko.cx/hykocx/lxs
@@ -19,7 +19,10 @@ if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
Write-Error 'Failed to fetch lib/common.ps1'
exit 1
}
. ([scriptblock]::Create($LxsLibSource))
# The library ships with a UTF-8 BOM (Windows PowerShell 5.1 needs it to
# read the file as UTF-8); over HTTP that BOM arrives as a leading U+FEFF
# character, which the parser will not accept.
. ([scriptblock]::Create(($LxsLibSource -replace '^\uFEFF', '')))
}
$env:LXS_LOG_FILE = Join-Path (Get-LxsTempDir) 'lxs_browsers.log'
+8 -5
View File
@@ -1,10 +1,10 @@
<#
<#
LXS - Claude Code (Windows)
Description: Install and check the Claude Code CLI.
Two supported install methods, both official:
- winget (Anthropic.ClaudeCode) does not auto-update
- the native installer from claude.ai updates itself in the background
- winget (Anthropic.ClaudeCode) - does not auto-update
- the native installer from claude.ai - updates itself in the background
Repo: https://git.hyko.cx/hykocx/lxs
#>
@@ -24,7 +24,10 @@ if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
Write-Error 'Failed to fetch lib/common.ps1'
exit 1
}
. ([scriptblock]::Create($LxsLibSource))
# The library ships with a UTF-8 BOM (Windows PowerShell 5.1 needs it to
# read the file as UTF-8); over HTTP that BOM arrives as a leading U+FEFF
# character, which the parser will not accept.
. ([scriptblock]::Create(($LxsLibSource -replace '^\uFEFF', '')))
}
$env:LXS_LOG_FILE = Join-Path (Get-LxsTempDir) 'lxs_claude_code.log'
@@ -67,7 +70,7 @@ function Install-LxsClaudeWinget {
Write-Host ''
Write-Host 'Installs the Anthropic.ClaudeCode package.'
Write-Host ''
Write-Host "$($script:Gray)winget installs do not update themselves run option 5, or$($script:NC)"
Write-Host "$($script:Gray)winget installs do not update themselves - run option 5, or$($script:NC)"
Write-Host "$($script:Gray)$('winget upgrade Anthropic.ClaudeCode'), to get new versions.$($script:NC)"
Write-Host ''
if (-not (Confirm-LxsAction -Question 'Install Claude Code with winget?' -DefaultYes)) {
+7 -4
View File
@@ -1,4 +1,4 @@
<#
<#
LXS - Containers and virtualization (Windows)
Description: WSL 2, Hyper-V, Docker Desktop and VirtualBox.
Repo: https://git.hyko.cx/hykocx/lxs
@@ -19,7 +19,10 @@ if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
Write-Error 'Failed to fetch lib/common.ps1'
exit 1
}
. ([scriptblock]::Create($LxsLibSource))
# The library ships with a UTF-8 BOM (Windows PowerShell 5.1 needs it to
# read the file as UTF-8); over HTTP that BOM arrives as a leading U+FEFF
# character, which the parser will not accept.
. ([scriptblock]::Create(($LxsLibSource -replace '^\uFEFF', '')))
}
$env:LXS_LOG_FILE = Join-Path (Get-LxsTempDir) 'lxs_containers.log'
@@ -86,7 +89,7 @@ function Install-LxsWsl {
Write-Host ''
& wsl.exe --install
if ($LASTEXITCODE -eq 0) {
Write-LxsOk 'WSL install started reboot to finish'
Write-LxsOk 'WSL install started - reboot to finish'
} else {
Write-LxsWarn "wsl --install exited with code $LASTEXITCODE"
}
@@ -110,7 +113,7 @@ function Enable-LxsHyperV {
Write-Host ''
try {
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All -All -NoRestart -ErrorAction Stop | Out-Null
Write-LxsOk 'Hyper-V enabled reboot to finish'
Write-LxsOk 'Hyper-V enabled - reboot to finish'
} catch {
Write-LxsErr "Could not enable Hyper-V: $($_.Exception.Message)"
}
+5 -2
View File
@@ -1,4 +1,4 @@
<#
<#
LXS - Dev Pack (Windows)
Description: The usual development toolchain, installed through winget.
Repo: https://git.hyko.cx/hykocx/lxs
@@ -19,7 +19,10 @@ if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
Write-Error 'Failed to fetch lib/common.ps1'
exit 1
}
. ([scriptblock]::Create($LxsLibSource))
# The library ships with a UTF-8 BOM (Windows PowerShell 5.1 needs it to
# read the file as UTF-8); over HTTP that BOM arrives as a leading U+FEFF
# character, which the parser will not accept.
. ([scriptblock]::Create(($LxsLibSource -replace '^\uFEFF', '')))
}
$env:LXS_LOG_FILE = Join-Path (Get-LxsTempDir) 'lxs_dev_pack.log'
+5 -2
View File
@@ -1,4 +1,4 @@
<#
<#
LXS - Apps index (Windows)
Description: Interactive menu listing the installers in windows\apps
Repo: https://git.hyko.cx/hykocx/lxs
@@ -19,7 +19,10 @@ if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
Write-Error 'Failed to fetch lib/common.ps1'
exit 1
}
. ([scriptblock]::Create($LxsLibSource))
# The library ships with a UTF-8 BOM (Windows PowerShell 5.1 needs it to
# read the file as UTF-8); over HTTP that BOM arrives as a leading U+FEFF
# character, which the parser will not accept.
. ([scriptblock]::Create(($LxsLibSource -replace '^\uFEFF', '')))
}
function Show-LxsAppsMenu {
+5 -2
View File
@@ -1,4 +1,4 @@
<#
<#
LXS - Utilities (Windows)
Description: Everyday utilities installed through winget.
Repo: https://git.hyko.cx/hykocx/lxs
@@ -19,7 +19,10 @@ if ($LxsLibPath -and (Test-Path $LxsLibPath)) {
Write-Error 'Failed to fetch lib/common.ps1'
exit 1
}
. ([scriptblock]::Create($LxsLibSource))
# The library ships with a UTF-8 BOM (Windows PowerShell 5.1 needs it to
# read the file as UTF-8); over HTTP that BOM arrives as a leading U+FEFF
# character, which the parser will not accept.
. ([scriptblock]::Create(($LxsLibSource -replace '^\uFEFF', '')))
}
$env:LXS_LOG_FILE = Join-Path (Get-LxsTempDir) 'lxs_utilities.log'