bug: wrong encoding when rtf opened in W7
bug: wrong encoding when rtf opened in W7
open rtf (uvviewsoft.com/beta/) in RVE. XP SP3: opened ok, russian ok. Win7- opened wrong: russian broken.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The main problem with this RTF file: it does not specify that the text is Russian. It has the following font table:
You can see only 3 fonts with defined charset: f1 and f4 with charset=0 (ANSI_CHARSET) and f2 with charset=2 (SYMBOL_CHARSET). Charsets for other fonts is undefined, so TRichView uses DEFAULT_CHARSET, and the result depends on the system default language (defined in the Control Panel).
On the other side, the text in this file is Unicode, so, if it is loaded as Unicode, charset is not so important. However, it cab be read correctly (without conversion from Unicode to ANSI) only if RV.RTFReadProperties = rvruOnlyUnicode
Code: Select all
{\fonttbl{\f0 \froman Times New Roman;}{\f1 \fscript \fcharset0 Monotype Corsiva;}{\f2 \froman \fcharset2 Symbol;}{\f3 \froman \fcharset0 Times New Roman;}{\f4 \froman \fcharset0 Arial;}{\f5 \froman Arial;}{\f6 \froman Wingdings;}}
On the other side, the text in this file is Unicode, so, if it is loaded as Unicode, charset is not so important. However, it cab be read correctly (without conversion from Unicode to ANSI) only if RV.RTFReadProperties = rvruOnlyUnicode
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
There are several language settings in Windows. The one that important is in the last tab of Regional and language settings, it is called Language for non-Unicode programs (or something like this).
But once again, the problem is in the RTF file itself. It does not specify that the text is Russian, so non-Unicode applications can read it differently.
As for RV.RTFReadProperties = rvruOnlyUnicode, it works correctly both for Unicode and non-Unicode RTF (when reading, non-Unicode text will be converted to Unicode). This is the default option for TRichView in Delphi 2009, 2010 and XE.
But once again, the problem is in the RTF file itself. It does not specify that the text is Russian, so non-Unicode applications can read it differently.
As for RV.RTFReadProperties = rvruOnlyUnicode, it works correctly both for Unicode and non-Unicode RTF (when reading, non-Unicode text will be converted to Unicode). This is the default option for TRichView in Delphi 2009, 2010 and XE.
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
i post demo- www.uvviewsoft.com/beta/RV.rar . Open w7.rtf - Win7 has broken encoding.