File always open in ANSI instead of UTF-8



  • Hi everyone, I have numerous file on my server and I want to work entirely in UTF-8 encoding. I configured Notepad++ via the Settings to set New documents in UTF-8 in ‘Settings > Preferences > New Document’.

    I ran into some problems when saving data on my MySQL database with french accents and while several files are set to UTF-8 when I open them in Notepad++ (I see the note on the bottom right corner of the editor), when I open some of them, it states ‘ANSI’. With that file, I then set ‘Encoding > Convert to UTF-8’, it states then that the file is ‘UTF-8’ in the bottom right corner, I close the file, it ask me to save (the file was converted from ANSI to UTF-8), I hit yes, and when I reopen the file, it states ANSI again, why it does that, shouldn’t be ‘UTF-8’, I just converted it to UTF-8, saved it and I can assure that the file was originally created in the UTF-8 format.

    Why it keeps opening in ANSI while other files you were created about the same time remains UTF-8?

    I must say that many of the files that are correct are bigger files while this one content is pretty slim, it is an ‘include’ file that I include from other pages to get variables.



  • Save files as UTF-8 with BOM.
    BOM forces Notepad++ to identify file as UTF-8.
    Make sure that whatever software is consuming these files knows to skip the BOM. Most modern software knows to do it for many years but some systems that retain ancient legacy software pieces may not.
    Without BOM Notepad++ needs to guess the encoding and sometimes it guesses wrong.
    This forum has multiple discussions about this issue and the desire to be able to override this guessing with some default.

    Since ANSI is a subset of UTF-8, in the absence of any special symbol within the file a UTF-8 is also an ANSI file and Notepad++ defaults to ANSI over UTF-8.


Log in to reply