In OpenTextFile(), when detecting the file's encoding, loop through 100K of text instead of only 16K, to make it slightly more stable against BOMless files containing only few UTF8 chars. Fixes issue #1860.

This commit is contained in:
Ansgar Becker
2010-05-22 06:45:54 +00:00
parent 6468776ba0
commit 3bc8ec6612

View File

@ -1976,7 +1976,7 @@ const
UNICODE_BOM_SWAPPED = Char($FFFE); UNICODE_BOM_SWAPPED = Char($FFFE);
UTF8_BOM = AnsiString(#$EF#$BB#$BF); UTF8_BOM = AnsiString(#$EF#$BB#$BF);
MinimumCountOfUTF8Strings = 1; MinimumCountOfUTF8Strings = 1;
MaxBufferSize = $4000; MaxBufferSize = 100000;
// 3 trailing bytes are the maximum in valid UTF-8 streams, // 3 trailing bytes are the maximum in valid UTF-8 streams,
// so a count of 4 trailing bytes is enough to detect invalid UTF-8 streams // so a count of 4 trailing bytes is enough to detect invalid UTF-8 streams