D2010-Rave-TRichEdit-cxDBRichEdit-ElevateDB: UTF8 / Unicode Print Problem

Hi - My project presents rtf data (stored in Unicode format via ElevateDB Table) and is fetched via DevExpress Editor cxDBRichEdit (bound to the Table CLOB Field) using the cxDBRichEdit.Properties.StreamModes:= [resmUnicode] for access.

The editing fetch/read/write cycle visually works correctly via the cxDBRichEdit - however once the Editor has touched the data we get Rave Print Issues (I believe that further up the chain it is a TRichEdit / RichEdit Unicode / UTF8 conflict).

When printing the rtf data with Rave we sometimes get random intermitant jibberish appended to the end of the valid data printout (I believe a Unicode / UTF8 conflict).

Speaking to both DevExpress and ElevateDB they assure me it is not a problem with their code and claim that it has something to do with the Delphi TRichEdit OR Microsoft RichEdit OR Both.

We know that the DevExpress cxDBRichEdit Editor is a wrapper arround the Delphi TRichEdit which in turn is a wrapper around Microsofts RichEdit - my code as follows:-

MemoBuf:= TMemoBuf.Create;
MemoBuf.BaseReport:= Sender as TBaseReport;

Code used to fetch rtf data from cxDBRichEdit Editor using TEncoding.UTF8 because TEncoding.Unicode FAILS:-

strStream:= TStringStream.Create('', TEncoding.UTF8);
TRichEdit(cxDBRichEdit.InnerControl).PlainText:= False;
TRichEdit(cxDBRichEdit.InnerControl).Lines.SaveToStream(strStream);
MemoBuf.RTFText:= strStream.DataString;
strStream.Free;

Code used to fetch rtf data from Table using TEncoding.Unicode (TEncoding.UTF8 FAILS as it should):-

bs:= Query1.CreateBlobStream(Query1.FieldByName('Notes'), bmRead);
sStream:= TStringStream.Create('', TEncoding.Unicode);
sStream.CopyFrom(bs, bs.Size);
MemoBuf.RTFText:= strStream.DataString;
strStream.Free;

So, somewhere within TRichEdit and/or RichEdit the string encoding is being confused.

Would someone be so kind as to show me how to force the Delphi TRichEdit OR Microsoft RichEdit (OR Both) to use Unicode and not UTF8 - Thanks in advance.

Andy
0
Andrew
10/16/2010 8:22:06 PM
embarcadero.delphi.win32 2183 articles. 0 followers. Follow

0 Replies
1050 Views

Similar Articles

[PageSpeed] 7

Reply: