Skip to content

v3.3.5 - Fix UTF-8 BOM Issue on Windows

Choose a tag to compare

@ChanMeng666 ChanMeng666 released this 04 Feb 10:12
· 112 commits to master since this release

🐛 Bug Fix: UTF-8 BOM Issue on Windows

This release fixes a critical bug that prevented audio from playing on Windows installations using the PowerShell installer.

🔍 Problem

When installing via install-windows.ps1, the .project_path file was written with a UTF-8 BOM (Byte Order Mark: \xef\xbb\xbf). This caused:

  • Path resolution failure in hook_runner.py
  • NO_AUDIO_CONFIG errors in hook trigger logs
  • Silent failures - no audio playback despite successful installation

✅ Fixes

File Change
scripts/install-windows.ps1 Use [System.IO.File]::WriteAllText() with explicit UTF-8 no-BOM encoding
hooks/hook_runner.py Use utf-8-sig codec to automatically handle BOM if present

🔧 Technical Details

PowerShell 5.x's -Encoding UTF8 parameter writes files with BOM by default. This is a known Windows PowerShell behavior. The fix uses .NET's UTF8Encoding class with $false parameter to explicitly disable BOM.

# Before (writes BOM)
$content | Out-File -FilePath $file -Encoding UTF8

# After (no BOM)
[System.IO.File]::WriteAllText($file, $content, [System.Text.UTF8Encoding]::new($false))

📦 Upgrade Instructions

If you previously installed and audio is not working:

cd claude-code-audio-hooks
git pull origin master

# Re-run installer
.\scripts\install-windows.ps1  # Windows PowerShell
# Or: bash scripts/install-complete.sh  # Git Bash/WSL

Or manually fix (without reinstalling):

# Remove BOM from existing .project_path file
$path = "$env:USERPROFILE\.claude\hooks\.project_path"
$content = [System.IO.File]::ReadAllText($path).TrimStart([char]0xFEFF)
[System.IO.File]::WriteAllText($path, $content, [System.Text.UTF8Encoding]::new($false))

🔍 How to Verify

Check hook trigger logs for PLAYED status instead of NO_AUDIO_CONFIG:

Get-Content "$env:TEMP\claude_audio_hooks_queue\logs\hook_triggers.log" -Tail 10

Expected output after fix:

2026-02-04 23:05:20 | stop | PLAYED | task-complete.mp3

Full Changelog: v3.3.4...v3.3.5