#930 Default encoding ignored when openin pure ascii files

closed
nobody
General (289)
5
2013-01-08
2013-01-08
Karol B
No

Got default encoding set to CP1250 for new and existing files. Also got 'Use fixed encoding..' checked.

Geany 1.22 still opens files as UTF-8 if a file doesn't contain any UTF8 or CP1250 encoded characters, (i.e. 0-127 ansi codes only). Same for empty files (0 byte length).

Checked on Ubuntu 10.04, XUbuntu 12.10 and Win7.

Discussion

  • Lex Trotman
    Lex Trotman
    2013-01-08

    • status: open --> closed
     
  • Lex Trotman
    Lex Trotman
    2013-01-08

    As the option says, "Use fixed encoding when using non-Unicode files". An ASCII file *is* a UTF-8 (ie Unicode) file and so is an empty file, so it won't use the fixed encoding. ASCII is the first 127 codes of Unicode and in UTF-8 they encode as single characters, ie themselves.

    The approach of opening anything you can as Unicode and then check fixed, locale or other encoding allows most files downloaded from the web to open correctly irrespective of what encoding most local files have.

    The fixed encoding option is only to override the locale or heuristic for files that don't open as Unicode.

    This process suits most Geany users and is unlikely to change without significant reason.