How can I set the default file format in the Delphi IDE to UTF8?

前端 未结 5 1085
无人及你
无人及你 2021-02-04 13:39

Delphi 2009 sets the default file format for new source code files to ANSI, this makes the source code platform-dependent.

Even for a new XSD file created in the IDE, wh

5条回答
  •  自闭症患者
    2021-02-04 13:55

    In fact this blog post from 2004 mentions a hidden IDE option. It states that you can set a default file filter in the registry to make UTF-8 the default encoding in Delphi 8. This still works under Tokyo! Clearly, you have to adapt the path of the registry key to recent versions like this:

    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Embarcadero\BDS\19.0\Editor]
    "DefaultFileFilter"="Borland.FileFilter.UTF8ToUTF8"
    

    After setting this value Delphi will encode new units in UTF-8 with BOM.

提交回复
热议问题