Menu

#20 Save source code in UTF8 format

None
closed-fixed
None
5
2016-06-04
2016-05-30
xander xiao
No

In Delphi, The source code default format is ANSI with local code page, this brings problems while a person in a different codepage computer open some of these files, it may crushs code, cause dcc32/64 failed to compile. for exmaple:

function TCustomSynEdit.IsWordBreakChar(AChar: WideChar): Boolean;
begin
...
case AChar of
#0..#32, '.', ',', ';', ':', '"', '''', '´', '`', '°', '^', '!', '?', '&',
'$', '@', '§', '%', '#', '~', '[', ']', '(', ')', '{', '}', '<', '>',
'-', '=', '+', '*', '/', '\', '|':
...
end;

here include some of chars which have different looks with different code page.I found three files listed below:
('ExternalSource\UniSynEdit\SynEdit.pas',
'ExternalSource\UniSynEdit\SynEditHighlighter.pas',
'ExternalSource\UniSynEdit\SynHighlighterXML.pas');

with which I must first open it with author local page code (I assume 1250) and save it with utf8.

Discussion

  • Thomas Mueller

    Thomas Mueller - 2016-06-02

    Can't be done as long as Delphi 6 and 7 are supported. These versions do not support UTF-8 source files. A possible workaround is to encode all these characters as in #nn notation.

     
  • Thomas Mueller

    Thomas Mueller - 2016-06-04

    I replaced all the non-ascii characters I found with their #$xxxx equivalent so this should be fine now.

     
  • Erik Berry

    Erik Berry - 2016-06-04
    • status: open --> closed-fixed
    • Group: -->
     

Log in to post a comment.

MongoDB Logo MongoDB