'Result' has to be initialized to nil before calling TEncoding.GetBufferEncoding().
Could you please add that to the sources.
function GetStreamEncoding(aStream: TStream): TEncoding;
var
Bytes: TBytes;
Size: Int64;
begin
Result := nil; // <----- THIS HAS TO BE ADDED.
aStream.Seek(0, soFromBeginning);
Size := aStream.Size;
SetLength(Bytes, Size);
aStream.ReadBuffer(Pointer(Bytes)^, Size);
TEncoding.GetBufferEncoding(Bytes, Result);
end;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using XE under Win7 x64 and MS IE v11 updated to the latest.
Here is the steps to produce the crash:
Use any UR
1) Press 'Navivage To URL'
2) Wait till it loads
3) Press 'Get HTML'
4) It crashes
I have traced it upto GetStreamEncoding() in cyIEUtils.pas and it crashes when TEncoding.GetBufferEncoding() is called in there.
I have no idea why it is happening.
Can someone help, please.
I've solved the mystery :)
'Result' has to be initialized to nil before calling TEncoding.GetBufferEncoding().
Could you please add that to the sources.
function GetStreamEncoding(aStream: TStream): TEncoding;
var
Bytes: TBytes;
Size: Int64;
begin
Result := nil; // <----- THIS HAS TO BE ADDED.
aStream.Seek(0, soFromBeginning);
Size := aStream.Size;
SetLength(Bytes, Size);
aStream.ReadBuffer(Pointer(Bytes)^, Size);
TEncoding.GetBufferEncoding(Bytes, Result);
end;
Hi,
thank you. Seems 64 bits/XE was the cause.
I will add your correction for next release.
Regards,
Mauricio