Edit tool corrupts UTF-8 BOM files on Windows (Hungarian/accented characters)

Resolved 💬 3 comments Opened May 18, 2026 by bensigel Closed May 21, 2026

Problem

The Edit tool removes the UTF-8 BOM and corrupts multi-byte UTF-8 sequences (Hungarian accented characters / ékezetes karakterek) when saving files on Windows.

Steps to reproduce

  1. Open a .vb (VB.NET) file that has UTF-8 BOM encoding (EF BB BF) and contains Hungarian accented characters (é, á, ő, ű, ö, ü, í, ó)
  2. Use the Edit tool to make any change — even a purely ASCII change in a different part of the file
  3. After the edit, the file has:
  • BOM removed
  • Multi-byte UTF-8 sequences for accented characters replaced with U+FFFD replacement characters (EF BF BD)

Expected behavior

UTF-8 BOM and all Unicode characters should be preserved exactly as-is after an edit.

Actual behavior

  • BOM (EF BB BF) at start of file is removed
  • Hungarian accented characters (é → \xef\xbf\xbd, á → \xef\xbf\xbd, etc.) are replaced with replacement chars
  • This corrupts the source file and causes compile errors / garbled strings at runtime

Workaround

Use PowerShell with explicit encoding:

$utf8bom = New-Object System.Text.UTF8Encoding($true)
$content = [System.IO.File]::ReadAllText($path, $utf8bom)
$newContent = $content.Replace($old, $new)
[System.IO.File]::WriteAllText($path, $newContent, $utf8bom)

Environment

  • OS: Windows 11 Pro
  • File type: VB.NET source (.vb)
  • File encoding: UTF-8 with BOM
  • Affected characters: Hungarian diacritics (accented/ékezetes characters) — é á ő ű ö ü í ó

Impact

This silently corrupts source files. The corruption is not visible until the application is compiled/run, at which point UI strings show garbled text instead of the correct accented characters.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗