Page 1 of 1
Double-Byte RTF stream?
Posted: Tue Aug 12, 2008 2:03 am
by pix
hi,
is there way to load UTF16 encoded RTF stream into TRichView?
it only support LoadRTFFromStream() which is single-byte stream.
Posted: Wed Aug 13, 2008 4:03 pm
by Sergey Tkachenko
Normally, RTF contains only characters with codes <127 (except for the mode when pictures are saved in a binary form, which is rarely used).
So, RTF data can be easily converted from UTF16 to ANSI.
Just load this RTF in WideString, assign this WideString to String (a conversion will be performed), save this String to Stream, load RTF from the stream.
This techinque is used by new versions of TRichView when loading RTF from unicode memo fields, supported by Delphi 2006+ (for example, from MS Access memos).