mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 20:19:29 +02:00
LazUtils: Extend xml reader to accept encoding name "UTF8" in addition to "UTF-8"
git-svn-id: trunk@52329 -
This commit is contained in:
parent
1236d8fbe8
commit
27e59768b3
@ -817,6 +817,12 @@ begin
|
|||||||
SameText(AEncoding, 'ISO8859-1');
|
SameText(AEncoding, 'ISO8859-1');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function Is_UTF8(const AEncoding: String): Boolean;
|
||||||
|
begin
|
||||||
|
Result := SameText(AEncoding, 'UTF-8') or
|
||||||
|
SameText(AEncoding, 'UTF8');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure BufAllocate(var ABuffer: TDOMCharBuf; ALength: Integer);
|
procedure BufAllocate(var ABuffer: TDOMCharBuf; ALength: Integer);
|
||||||
begin
|
begin
|
||||||
ABuffer.MaxLength := ALength;
|
ABuffer.MaxLength := ALength;
|
||||||
@ -1216,7 +1222,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
{$IFDEF UseWideString}
|
{$IFDEF UseWideString}
|
||||||
if (FFixedUCS2 = '') and SameText(AEncoding, 'UTF-8') then
|
if (FFixedUCS2 = '') and Is_UTF8(AEncoding) then
|
||||||
Exit;
|
Exit;
|
||||||
if FFixedUCS2 <> '' then
|
if FFixedUCS2 <> '' then
|
||||||
begin
|
begin
|
||||||
@ -1228,7 +1234,7 @@ begin
|
|||||||
// TODO: must fail when a byte-based stream is labeled as word-based.
|
// TODO: must fail when a byte-based stream is labeled as word-based.
|
||||||
// see rmt-e2e-61, it now fails but for a completely different reason.
|
// see rmt-e2e-61, it now fails but for a completely different reason.
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
if SameText(AEncoding, 'UTF-8') then
|
if IS_UTF8(AEncoding) then
|
||||||
Exit;
|
Exit;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FillChar(NewDecoder{%H-}, sizeof(TDecoder), 0);
|
FillChar(NewDecoder{%H-}, sizeof(TDecoder), 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user