kooloveme / thtmlviewer

Automatically exported from code.google.com/p/thtmlviewer
Other
0 stars 0 forks source link

THtmlViewer.documentSource #348

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which steps will reproduce the problem?
1. Load a simple document (no encoding) in THtmlViewer
2. Check the documentSource property

What is the expected output? 
The document source.

What do you see instead?
A truncted string.

Which version of the product are you using? 11.4

Which compiler version are you using? Delphi 7

On which operating system? XP

Please provide any additional information:

THtmlViewer.documentSource property 
gets a truncated text (at least when FCodePage = CP_UTF16LE).

It boils down to the property TbufferConverter.AsString

I think that the code should read:
//-------------------
function TBuffConverter.AsString: TBuffString;
var
  Bytes, Chars: Integer;
  OldPos: PByte;
begin
  Bytes := FEnd.AnsiChr - FPos.AnsiChr;
  if (FCodePage = CP_UTF16LE) and (FInitalCodePage = CP_UTF16LE) then
  begin
//>> Commented     Bytes := Bytes div 2;           
//>> set length is Char size:
    SetLength(Result, Bytes div sizeOf(TBuffChar));  
    System.Move(FPos.BytePtr^, Result[1], Bytes);
  end
  else
  begin

Original issue reported on code.google.com by miguelGa...@gmail.com on 26 Apr 2014 at 6:00

GoogleCodeExporter commented 9 years ago
Thanks for spotting this issue.

Issue 305 had reported it before and revision r437 fixed it in Oct 2013.

Original comment by OrphanCat on 27 Apr 2014 at 10:39

GoogleCodeExporter commented 9 years ago
Sorry I didn't noticed that it was fixed.

Thanks for your time.

Miguel

Original comment by miguelGa...@gmail.com on 3 May 2014 at 10:18