1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

config: skip UTF-8 BOM in primary config file

This is a semi-effective band-aid, as it won't change lua's own
lack of BOM support when importing files via `require`.

refs: #1452
This commit is contained in:
Wez Furlong 2021-12-22 07:34:34 -07:00
parent 1c9b9f69e0
commit 008b7f3796

View File

@ -1512,7 +1512,10 @@ impl Config {
let lua = make_lua_context(p)?;
let config: mlua::Value = smol::block_on(
lua.load(&s)
// Skip a potential BOM that Windows software may have placed in the
// file. Note that we can't catch this happening for files that are
// imported via the lua require function.
lua.load(s.trim_start_matches('\u{FEFF}'))
.set_name(p.to_string_lossy().as_bytes())?
.eval_async(),
)?;