Unicode strings
The main change in this update: all strings are changed to TRVUnicodeString, where it is possible.
TRVUnicodeString is defined as WideString for old versions of Delphi (Delphi 5-2007) and UnicodeString for new versions of Delphi (2009-10.2 Tokyo)
This change has many benefits for users of old versions of Delphi. Now they have Unicode spelling check interface, Unicode object properties, can use Unicode file names for saving and loading (for Delphi 6 and newer).
However, this change is useful in new versions as well:
- names of non-text items were ANSI string in previous version, now they are Unicode
- you can be sure that all text in the editor is Unicode
- no need to work with raw byte strings
Unfortunately, this change breaks compatibility. In existing projects, you need to change types of string parameters of events to TRVUnicodeString.
TRVUnicodeString is defined in RVTypes unit.
The main goal of this change is simplifying porting to other development frameworks.
UTF-16
Delphi strings (UnicodeString and WideString) have UTF-16 encoding, so they can contain Unicode characters having codes greater than $FFFF. They are represented as two WideChars. They are called a
surrogate pair.
Previously, such characters were not processed correctly. In this version, they are completely supported.
Typing Unicode characters
You can type a hexadecimal code in the editor and press Alt+X; this code will be converted to Unicode character. Press Alt+X again to convert it back to its code. For example, you can type
1F43B, press Alt+X, and it will be converted to
(your browser may convert this character to emoji icon; TRichView does not do it)
More exactly, when you press Alt+X, TRichViewEdit checks characters to the left of the caret (or selected characters, if there is a selection). If they can be interpreted as a hexadecimal number, TRichViewEdit converts it to a character. If not, it converts the last character to its hexadecimal code.
Additionally, you can hold Alt key and type a decimal character code on the numpad, starting from '0'. Release Alt, and Unicode character will be inserted. Normally, in this way, Windows allows entering a character from the current code page, not a Unicode character. But MS Word inputs a Unicode character, and we decided to do it too.
Export of symbol text
This version improves conversion of symbol characters to Unicode. This conversion is happen when TRichView content is exported to HTML or plain Unicode text: symbol characters are exported as the most similar Unicode characters. In the previous version, this conversion was supported for "Symbol" font and partially for "Wingdings". In this version, this conversion is supported for "Symbol", "Wingdings", "Wingdings 2", "Wingdings 3", "Webdings" fonts.