fix, prevent a DUB json withucs-x BOM to be overwritten with a dummy structure

This commit is contained in:
Basile Burg 2015-11-28 02:11:35 +01:00
parent 9a9f74149f
commit ea9b3af4dd
1 changed files with 3 additions and 1 deletions

View File

@ -178,6 +178,7 @@ begin
loader.WriteByte(byte('{'));
loader.WriteByte(byte('}'));
loader.Position:= 0;
fFilename := '';
end
else if ((bom and $FEFF) = $FEFF) or ((bom and $FFFE) = $FFFE) then
begin
@ -186,12 +187,13 @@ begin
loader.WriteByte(byte('{'));
loader.WriteByte(byte('}'));
loader.Position:= 0;
fFilename := '';
end
else
loader.Position:= 0;
//
FreeAndNil(fJSON);
parser := TJSONParser.Create(loader);
parser := TJSONParser.Create(loader, fSaveAsUtf8);
try
try
fJSON := parser.Parse as TJSONObject;