diff --git a/aegisub/src/auto4_lua_scriptreader.cpp b/aegisub/src/auto4_lua_scriptreader.cpp index e7fcf0b38..3206df6fe 100644 --- a/aegisub/src/auto4_lua_scriptreader.cpp +++ b/aegisub/src/auto4_lua_scriptreader.cpp @@ -50,6 +50,8 @@ namespace Automation4 { size_t out_bytes = sizeof(buf); conv->Convert(&in, &in_bytes, &out, &out_bytes); + if (in_bytes > 0 && in != in_buf) + file.seekg(-(std::streamoff)in_bytes, std::ios_base::cur); *bytes_read = out - buf; // Skip the bom