Skip to content

Commit 339c09d

Browse files
author
outchy
committed
Mantis 5490: TJclSimpleXml.LoadFromString can't read a string with a byte order mark (BOM).
1 parent 1e2ea66 commit 339c09d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

jcl/source/common/JclSimpleXml.pas

+1-1
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ procedure TJclSimpleXML.LoadFromString(const Value: string);
12001200
var
12011201
Stream: TStringStream;
12021202
begin
1203-
Stream := TStringStream.Create(Value);
1203+
Stream := TStringStream.Create(Value {$IFDEF SUPPORTS_UNICODE}, CP_UTF16LE{$ENDIF});
12041204
try
12051205
LoadFromStream(Stream);
12061206
finally

jcl/source/common/JclStreams.pas

+1-1
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ function TJclStringStream.InternalSetNextBuffer(S: TStream;
24022402

24032403
procedure TJclStringStream.InvalidateBuffers;
24042404
begin
2405-
FStrBufferStart := FStream.Seek(0, soCurrent);
2405+
FStrBufferStart := FStream.Seek(Length(FBOM), soCurrent);
24062406
FStrBufferNext := FStrBufferStart;
24072407
FStrBufferPosition := 0;
24082408
FStrBufferCurrentSize := 0;

0 commit comments

Comments
 (0)