Menu

Request: better utf-8 encoding options

2007-09-10
2012-11-13
  • Nobody/Anonymous

    Currently, there's only the option of 'UTF-8 without BOM', or 'ANSI as UTF-8' which hardly makes sense because the file is in fact UTF-8 and not ANSI at all. When you open a file saved as UTF-8 without BOM, it will only go into UTF-8 mode if the file contains any UTF-8 character sequences. If the file is just plain ASCII, it will open it as ANSI despite having been saved as UTF-8. Of course that makes sense, because The first 128 code points of UTF-8 and ANSI are exactly the same (i.e. ASCII), and without a UTF-8 BOM N++ has no way to tell them apart. So here's my suggestion:

    - Add a global option to open ASCII-only files as either ANSI or UTF-8 by default. That way, if you're working with BOM-less UTF-8 files, you don't run the risk of accidentally saving characters past 128 as ANSI encoding later on, breaking stuff like UTF-8 XML files in the process.

    - Make a 'No BOM' toggle option independent of UTF encoding (and unavailable for ANSI) to replace the current 'ANSI as UTF-8' option. That way, UTF-16 without BOM should also be possible (yes, it is used). This option should also be able to be set as default encoding for new files in the options.

     
    • Nobody/Anonymous

      I agree. BOM has nothing to do with ANSI. Currently (in version 4.2.2) to remove BOM from UTF-8, you have to change UTF-8 -> Ansi -> UTF-8 without BOM, which is wrong.