lazutils: UTF8BOMToUTF8: sanity check

git-svn-id: trunk@64700 -
This commit is contained in:
mattias 2021-02-28 22:39:58 +00:00
parent bacadab499
commit efc5ef502b

View File

@ -358,7 +358,11 @@ end;
function UTF8BOMToUTF8(const s: string): string;
begin
Result:=copy(s,4,length(s));
if s='' then exit('');
if CompareMem(@UTF8BOM[1],@s[1],length(UTF8BOM)) then
Result:=copy(s,4,length(s))
else
Result:=s;
end;
function ISO_8859_1ToUTF8(const s: string): string;