only handle ANSI and UTF-8 encoede dub project

- UCS 2/4 crashes te parser
- DUB itself does not support these encodings
This commit is contained in:
Basile Burg 2015-09-22 21:44:40 +02:00
parent d8cde2ecf2
commit da958707dd
1 changed files with 16 additions and 8 deletions

View File

@ -164,14 +164,22 @@ begin
loader.Read(bom, 4);
if (bom and $BFBBEF) = $BFBBEF then
loader.Position:= 3
else if bom = $FFFE0000 then
loader.Position:= 4
else if bom = $FEFF then
loader.Position:= 4
else if (bom and $FEFF) = $FEFF then
loader.Position:= 2
else if (bom and $FFFE) = $FFFE then
loader.Position:= 2
else if (bom = $FFFE0000) or (bom = $FEFF) then
begin
// UCS-4 LE/BE not handled by DUB
loader.clear;
loader.WriteByte(byte('{'));
loader.WriteByte(byte('}'));
loader.Position:= 0;
end
else if ((bom and $FEFF) = $FEFF) or ((bom and $FFFE) = $FFFE) then
begin
// UCS-2 LE/BE not handled by DUB
loader.clear;
loader.WriteByte(byte('{'));
loader.WriteByte(byte('}'));
loader.Position:= 0;
end
else
loader.Position:= 0;
//