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 73cc2d21c6
commit 0e3b383c4b
1 changed files with 2 additions and 0 deletions

View File

@ -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