Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004632 [JEDI VCL] 00 JVCL Components block always 2008-12-21 09:44 2012-09-10 14:15
Reporter cab View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.35
Summary 0004632: jvDBRichEdit shows rtf code instead of formatted text
Description When the component is showing its contents it looks like this:

I am typing the following text:
This a test - testing error.

and when approving it (write to database it looks like this:
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
{\*\generator Riched20 12.0.6211.1000;}\viewkind4\uc1
\pard\cf1\f0\fs16\lang1030 This a test - testing error.\par
}
Additional Information I am using delphi 2009, on Vista Business SP1.
Have tried Riched20.dll from both Windows and Office 2003
Tags No tags attached.
Attached Files

- Relationships
has duplicate 0004571resolvedobones JvRichEdit 

-  Notes
(0015122)
cab (reporter)
2008-12-21 12:44

Just tried Delphi7 with jvcl 3.33 - and this combination works OK.
Apparently the problem are due toimplementation of unicode in the Delphi2009 version of the jvcl?
(0015124)
cab (reporter)
2008-12-21 14:45

This is the same issue as 0004571.
And I have traced the error down to the following function:

function TJvRTFConversion.IsFormatCorrect(AStream: TStream): Boolean;
const
  CRTFHeader = '{\rtf';
  CRTFHeaderSize = Length(CRTFHeader);
var
  SavedPosition: Int64;
  Buffer: array[0..CRTFHeaderSize] of Char; // + #0
begin
  SavedPosition := AStream.Position;
  try
    Buffer[CRTFHeaderSize] := #0;

    Result :=
      (AStream.Read(Buffer, CRTFHeaderSize) = CRTFHeaderSize) and
      (StrIComp(PChar(CRTFHeader), Buffer) = 0);
  finally
    AStream.Position := SavedPosition;
  end;
end;

the AStream.Read reads unicode in delphi 2009, so the compare with CRTFHeader (= '{\rtf') will not match the read unicode characters, which are: ('?', '?', '?', '?', '?', #0).

If I change this to the following it works, but I'm not sure if this is the correct way of doing it:
function TJvRTFConversion.IsFormatCorrect(AStream: TStream): Boolean;
const
  CRTFHeader = '{\rtf';
  CRTFHeaderSize = Length(CRTFHeader);
var
  SavedPosition: Int64;
  Buffer: array[0..CRTFHeaderSize] of ansiChar; // + #0
begin
  SavedPosition := AStream.Position;
  try
    Buffer[CRTFHeaderSize] := #0;

    Result :=
      (AStream.Read(Buffer, CRTFHeaderSize) = CRTFHeaderSize) and
      (StrIComp(PansiChar(CRTFHeader), Buffer) = 0);
  finally
    AStream.Position := SavedPosition;
  end;
end;
(0015125)
obones (administrator)
2008-12-22 04:16

Thanks, it does look interesting.
Pending further investigation on the source of the Stream
(0019581)
obones (administrator)
2012-02-27 14:01

This was fixed back in March 2009:

ahuser 21/03/2009 23:18:25
Unicode bugfixes

- Issue History
Date Modified Username Field Change
2008-12-21 09:44 cab New Issue
2008-12-21 12:44 cab Note Added: 0015122
2008-12-21 14:45 cab Note Added: 0015124
2008-12-22 04:15 obones Relationship added related to 0004571
2008-12-22 04:16 obones Note Added: 0015125
2008-12-22 04:16 obones Status new => acknowledged
2009-04-29 15:36 obones Relationship replaced has duplicate 0004571
2012-02-27 14:01 obones Note Added: 0019581
2012-02-27 14:01 obones Status acknowledged => resolved
2012-02-27 14:01 obones Fixed in Version => Daily / SVN
2012-02-27 14:01 obones Resolution open => fixed
2012-02-27 14:01 obones Assigned To => obones
2012-09-10 14:15 obones Fixed in Version Daily / SVN => 3.46


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker