delphifile-encodingsrad-studio

How can I configure the IDE code editor to save files as "UTF-8 without BOM"?


The Rad Studio has an editor option for the file encoding. By default it's configured as Ansi and can be UTF-8 among others. If you want to change this default, for example, to UTF-8 this can be performed through the registry:

[HKEY_CURRENT_USER\Software\Embarcadero\BDS\20.0\Editor] "DefaultFileFilter"="Borland.FileFilter.UTF8ToUTF8"

Then, the files are saved as UTF-8 but with the BOM mark. The question is how can be saved as UTF-8 but without the BOM mark?


Solution

  • There is no option to do this. The BOM is required by the IDE to distinguish ANSI encoded files from UTF-8. If you remove the BOM the IDE will not properly identify the file as UTF-8 encoded.