Skip to content

Commit 4711a56

Browse files
julienldclaude
andcommitted
fix: write JSON config without UTF-8 BOM on Windows
PowerShell's Set-Content -Encoding UTF8 adds a Byte Order Mark (BOM) at the start of the file. Claude Desktop's JSON parser rejects BOM, causing "Unexpected token" error on startup. Fixed by using .NET's WriteAllText() which writes UTF-8 without BOM. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a405f61 commit 4711a56

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

scripts/install-windows.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,13 @@ if (Test-Path $ConfigFile) {
9898

9999
# For simplicity, we write the clean config (merging would require complex JSON handling)
100100
# The backup preserves any other MCP servers the user had
101-
$JsonConfig | Set-Content $ConfigFile -Encoding UTF8
101+
# Use .NET to write UTF-8 without BOM (PowerShell's -Encoding UTF8 adds BOM which breaks JSON parsers)
102+
[System.IO.File]::WriteAllText($ConfigFile, $JsonConfig)
102103
Write-Host " Configuration updated successfully" -ForegroundColor White
103104
} else {
104105
# Create new config file
105-
$JsonConfig | Set-Content $ConfigFile -Encoding UTF8
106+
# Use .NET to write UTF-8 without BOM (PowerShell's -Encoding UTF8 adds BOM which breaks JSON parsers)
107+
[System.IO.File]::WriteAllText($ConfigFile, $JsonConfig)
106108
Write-Host " Created new configuration file" -ForegroundColor White
107109
}
108110
Write-Host " Claude Desktop configured" -ForegroundColor Green

0 commit comments

Comments
 (0)