Notepad++ and wrong ANSII encoding

  • Hello everybody : I have the following C# code which converts an UTF8 W/O BOM into an Windows-1252 textfile:

            string inputstring = File.ReadAllText(@"c:\tmp\stringa.txt");
            var srcEncoding = Encoding.UTF8;
            var destEncoding = Encoding.GetEncoding(1252);
            var destBytes = Encoding.Convert(srcEncoding, destEncoding, srcEncoding.GetBytes(inputstring ));
            var destString = destEncoding.GetString(destBytes);
            File.WriteAllBytes(@"c:\tmp\output0.txt", destBytes);
            return destEncoding.ToString();

    When I open the output0 file into Windows notepad I can see the italian accent letters right, but if I open Notepad++ the ANSI codepage is Windows-1251 and not Windows-1252.

    The original file is an UTF-8 file created with Notepad++ , and Windows is configured with the Italian codepage (1252) correctly.

  • @LuciferSam86

    may I ask which npp version (debug-info from ? menu) and windows version you use?
    How did you configure Settings->Preferences->New Document->Encoding?


  • Hello, here the debug info:
    Notepad++ v7.5 (32-bit)
    Build time : Aug 15 2017 - 23:02:57
    Path : C:\Program Files (x86)\Notepad++\notepad++.exe
    Admin mode : OFF
    Local Conf mode : OFF
    OS : Windows 10 (64-bit)
    Plugins : mimeTools.dll NppConverter.dll NppExport.dll

    The O/S is Windows 10 Professional 64 bit Italian

    The encoding of “New Document” is:

    • UTF-8 and is enabled the sub-option “Apply to opened ANSI files”

    Thank you

  • Hi @luciferqam86, @claudia-frank and All,

    Is it better if you uncheck the Autodetect character encoding option, in Settings - Preferences… - MISC ?

    Sometimes this auto-detection causes some problems, instead of avoiding them :-D

    Best Regards,


Log in to reply