Handle partial characters at the end of the read buffer when loading Lua scripts. Closes #1576.

This commit is contained in:
Thomas Goyne 2013-02-12 15:50:37 -08:00
parent 1f5484fedb
commit 959be0a64a
1 changed files with 2 additions and 0 deletions

View File

@ -47,6 +47,8 @@ namespace Automation4 {
size_t out_bytes = sizeof(buf); size_t out_bytes = sizeof(buf);
conv->Convert(&in, &in_bytes, &out, &out_bytes); 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; *bytes_read = out - buf;
// Skip the bom // Skip the bom