t3code
t3code copied to clipboard
File viewer: support non-UTF-8 encodings (e.g. Windows-1252 / ISO-8859-1)
Opening a legacy source file saved in Windows-1252 in the file viewer shows "This file is not UTF-8 text. Open it in another app to view its contents."
Many legacy codebases (PHP, Delphi, older Java) still keep sources in CP1252/Latin-1, and converting them isn't an option because the runtime depends on the original bytes.
Suggestion:
- Detect common single-byte encodings (CP1252, ISO-8859-1), or fall back to one, and render the file read-only with a "Detected encoding: Windows-1252" badge.
- Let the user pick the encoding manually ("Reopen with encoding…"), and optionally set a per-project default.
- Never re-save the file in a different encoding.
Repro: create a file with printf 'acentua\xe7\xe3o\n' > test.php and open it in the viewer.
Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.