Special characters can be used in the source, but not in names of functions, variables, classes, objects, etc. They remain as ASCII characters. In code, only literals and comments can use Unicode.
When saving a DataFlex source file in the Studio, it saves it as UTF-8 with a Byte Order Mark (BOM).
This comparison tool shows the difference between a file from the packages folder in DataFlex 19.1 and in DataFlex 2021. The only difference here is the UTF-8 BOM, which is a set of three bytes at the beginning of the file. These three bytes are not shown in this editor and are also not shown in the Studio editor.
Here it shows that the DataFlex 2021 file is encoded in UTF-8 with a BOM. The 19.1 file shows ANSI because there is no BOM and the comparison tool cannot tell the difference between OEM and ANSI. But it is OEM.
Upon saving a file in the Studio, the BOM is added at the beginning of the file, if it is not there yet. This way, upon reopening the file, the Studio recognizes that the file is encoded in UTF-8 and should be read as such. If the BOM is not there, then OEM is assumed.
Existing sources from 19.1 have no BOM and are opened as OEM.
It can be switched off if a BOM is not to be written, for example when the sources in 19.1 are used as a library.
To switch it off, go to Tools > Configure Studio > Editor tab, and select the option to save source files as OEM.
When saving a source file that has not been opened before in DataFlex 2021, that has had special characters added to it, a prompt will appear indicating that the special characters will be lost if saved as OEM. would mean that the special characters will be lost and provides an option to save as UTF-8 instead.
Typically, this option is switched off. All files will now be saved as UTF-8 again. To turn it off, select the Tools menu > Configure Studio > Editor Tab > DESELECT ‘Save source files as OEM’.
Files are only converted to UTF-8 upon being saved in the Studio, not during migration. Sources in the packages folder have been converted to include a UTF-8 BOM. Non-DataFlex files, such as HTML and TXT files are always assumed to be UTF-8, whether or not there is a BOM. If a BOM exists it will be preserved.