Expand description
Read text from the host filesystem in a Windows-friendly way.
Windows editors often save scripts as UTF-8 with BOM or UTF-16 LE with BOM (“Unicode” in
Notepad). std::fs::read_to_string assumes UTF-8 only, which can yield mojibake or load failures.
VFS export/sync for cargo/rustup already uses binary std::fs::read / write; this module
targets text loads: -f scripts, source / . from disk, nested source in .dsh, and
.todo.json.
Functions§
- decode_
host_ text_ bytes - Decode bytes from a host text file: UTF-16 LE/BE (with BOM), else UTF-8 (optional BOM).
- read_
host_ text - Read a host file and decode as for
decode_host_text_bytes. - script_
text_ from_ vfs_ bytes - Decode VFS file bytes as script/JSON text (UTF-8 with optional BOM, or UTF-16 with BOM).
- strip_
utf8_ bom - Strip a leading UTF-8 BOM (
EF BB BF) if present.