Page 1 of 1
Compatibility unicode<->non-unicode RVF-file content?
Posted: Mon Dec 20, 2010 6:38 pm
by rv777
At the moment I want to write the content of TRichView to a database field with Delphi 7 in non unicode format. As such I use SaveRVFToStream(MyStream, false).
Now the question is, what will happen if I will porting my applications to Delphi XE with unicode? Will I still be able to use that db-data saved with the old Delphi 7 application or will there be a problem than, as XE will be Unicode enabled?
Is it better to save the binary format in UTF8 in D7 too, instead simple ansistring? Does RV use its own internal binary format, so it will not be a problem at all, as there is no unicode or ansi involved here?
Posted: Mon Dec 20, 2010 6:50 pm
by Sergey Tkachenko
When you compile your application on Delphi XE, it will be able to load your old RVF document. All text will be converted to Unicode when loaded, automatically.
Posted: Mon Dec 20, 2010 7:41 pm
by rv777
Ok thanks, but what happens the other way around, when I load the data saved with XE with my old D7 application? Would that not give problems with unicode data?
So I think about to save in D7 my richtext in UTF8 to the database, but I'm not sure what I exactly must do, as the RVF seems to be binary data? So where should I convert the data to UTF8 without to convert the binary data to UTF8?
Posted: Tue Dec 21, 2010 4:59 pm
by Sergey Tkachenko
If you use new version of TRichView (11 or newer) in Delphi 7 to load RVF data saved in Delphi XE, then:
- text styles will be loaded as Unicode (assuming that RVF contains collections of RVF styles inside)
- string properties and tag strings (that were stored as UTF-8) will be loaded as ANSI text (converted from UTF-8 to ANSI).
RVF files saved by TRichView compiled in Delphi 2009-XE and compiled in Delphi 3-2007 are slightly different. In Unicode versions of Delphi, item properties and tags are saved as UTF-8. In older version, as ANSI text. TRichView version 11 or newer can distinguish these files, and load them correctly, converting to/from UTF-8 when necessary.
You should not convert to UTF-8 yourself. In Delphi 3-2007, TRichView assumes ANSI text in string properties and tags. If you will use UTF-8 there, these files will not be loaded correctly by applications compiled in Delphi 2009-XE.
Posted: Tue Dec 21, 2010 10:49 pm
by rv777
Ok, thank you.