$htmlFiles = Get-ChildItem -Path "site" -Recurse -Filter "*.html" | Select-Object -ExpandProperty FullName
foreach ($file in $htmlFiles) {
    $content = Get-Content $file -Raw -Encoding UTF8
    
    # Use string .Replace() for exact literal matches, not regex
    $content = $content.Replace('â€¦', '...')
    $content = $content.Replace('â†’', '&rarr;')
    $content = $content.Replace('â€”', '&mdash;')
    $content = $content.Replace('â€“', '&ndash;')
    $content = $content.Replace('â€¢', '&bull;')
    $content = $content.Replace('Â·', '&middot;')
    $content = $content.Replace('â€™', "'")
    $content = $content.Replace('â€˜', "'")
    $content = $content.Replace('â€œ', '"')
    $content = $content.Replace('â€', '"')
    $content = $content.Replace('Â ', ' ')

    Set-Content -Path $file -Value $content -Encoding UTF8
}
Write-Host "Fixed mojibake in HTML files."
