Community
    • Login

    N++ opens ANSI file incorrectly in Win11 - why?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 3 Posters 224 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Kim S. AndreasenK
      Kim S. Andreasen
      last edited by

      Hi,
      I am having a character set problem in Win11.
      I use a lot of ANSI files containing national Danish characters. For example .CSV files containing account data downloaded from banks.
      The problem is that NP++ does not open such files correctly in Win11. The Danish characters are wrong. even if NP++ says that it is an ANSI file.
      It doesn’t matter if I have the ‘Auto detect character encoding’ set or not.
      If I open the exact same file on a Win10 pc using the exact same version of NP++ the file is 100 % perfect. It looks as if Win11 does something fishy that NP++ doesn’t handle correctly. Can anybody help?

      This is how part of the file looks in Win11:
      “Dato”;“Val�r”;“Tekst”;“”;“Bel�b”;“Saldo”;“Afstemt”
      “15.07.2024”;“15.07.2024”;“Bane4mandag 19-20 -SE MEDD.”;“”;“3.600,00”;“182.394,69”;“ja”
      “Afsender”;“EDB-OPERAT�R”

      This is how it looks in Win10 (correct):
      “Dato”;“Valør”;“Tekst”;“”;“Beløb”;“Saldo”;“Afstemt”
      “15.07.2024”;“15.07.2024”;“Bane4mandag 19-20 -SE MEDD.”;“”;“3.600,00”;“182.394,69”;“ja”
      “Afsender”;“EDB-OPERATØR”

      Thanks in advance!
      …/Kim

      CoisesC PeterJonesP 2 Replies Last reply Reply Quote 2
      • CoisesC
        Coises @Kim S. Andreasen
        last edited by Coises

        @Kim-S-Andreasen

        Please click the ? at the right end of the menu bar, select Debug Info… from the menu, click Copy debug info to clipboard and paste what is copied into a reply here.

        If you can do that for Notepad++ on both computers, that would be even better.

        There’s a bit of important information in that — specifically, “Current ANSI codepage” — which might explain what is happening.

        Kim S. AndreasenK 1 Reply Last reply Reply Quote 2
        • PeterJonesP
          PeterJones @Kim S. Andreasen
          last edited by

          @Kim-S-Andreasen ,

          Further to @Coises suggestion, please also check the Settings > Preferences > New Document page for the Encoding section, and see if the settings are different on each machine.

          And finally, on each machine, when it auto-detects encoding, does the lower right of the status bar say ANSI on both, or does it say something different (like maybe UTF-8):

          179d9587-7ca6-4f83-994f-28dfeec8c749-image.png

          vs

          b849a4ab-af57-47a5-8dad-ecf01e8c1d72-image.png

          vs something else?

          1 Reply Last reply Reply Quote 1
          • Kim S. AndreasenK
            Kim S. Andreasen @Coises
            last edited by

            @Coises, @Peter Jones
            Hi,
            Thanks for your replies.

            Here is debug infor for Win11:
            Notepad++ v8.8.5 (64-bit)
            Build time: Aug 14 2025 - 00:32:39
            Scintilla/Lexilla included: 5.5.7/5.4.5
            Boost Regex included: 1_85
            Path: C:\Program Files\Notepad++\notepad++.exe
            Command Line: “C:\Temp\kontobevaegelser (2).csv”
            Admin mode: OFF
            Local Conf mode: OFF
            Cloud Config: OFF
            Periodic Backup: ON
            Placeholders: OFF
            Scintilla Rendering Mode: SC_TECHNOLOGY_DIRECTWRITE (1)
            Multi-instance Mode: monoInst
            asNotepad: OFF
            File Status Auto-Detection: cdEnabledNew (for current file/tab only)
            Dark Mode: OFF
            Display Info:
            primary monitor: 2560x1440, scaling 100%
            visible monitors count: 1
            installed Display Class adapters:
            0000: Description - Intel® Iris® Xe Graphics
            0000: DriverVersion - 32.0.101.6913
            OS Name: Windows 11 Pro (64-bit)
            OS Version: 25H2
            OS Build: 26200.6725
            Current ANSI codepage: 65001
            Plugins:
            NppConverter (4.6)
            NppExport (0.4)

            The same for Win10:
            Notepad++ v8.8.5 (64-bit)
            Build time: Aug 14 2025 - 00:32:39
            Scintilla/Lexilla included: 5.5.7/5.4.5
            Boost Regex included: 1_85
            Path: C:\Program Files\Notepad++\notepad++.exe
            Command Line:
            Admin mode: OFF
            Local Conf mode: OFF
            Cloud Config: OFF
            Periodic Backup: ON
            Placeholders: OFF
            Scintilla Rendering Mode: SC_TECHNOLOGY_DIRECTWRITE (1)
            Multi-instance Mode: monoInst
            asNotepad: OFF
            File Status Auto-Detection: cdEnabledNew (for current file/tab only)
            Dark Mode: OFF
            Display Info:
            primary monitor: 2560x1440, scaling 100%
            visible monitors count: 1
            installed Display Class adapters:
            0001: Description - Intel® HD Graphics 5000
            0001: DriverVersion - 20.19.15.4624
            0002: Description - Microsoft Remote Display Adapter
            0002: DriverVersion - 10.0.19041.5794
            0003: Description - Microsoft Remote Display Adapter
            0003: DriverVersion - 10.0.19041.5794
            0004: Description - Microsoft Remote Display Adapter
            0004: DriverVersion - 10.0.19041.5794
            - warning, search has been limited to maximum number of adapter records: 4
            OS Name: Windows 10 Pro (64-bit)
            OS Version: 22H2
            OS Build: 19045.6396
            Current ANSI codepage: 1252
            Plugins:
            mimeTools (3.1)
            NppConverter (4.6)
            NppExport (0.4)

            In both cases the status line shows 'Unix (LF)" and “ANSI”.
            In both cases autodetect is ON.

            Kim S. AndreasenK 1 Reply Last reply Reply Quote 1
            • Kim S. AndreasenK
              Kim S. Andreasen @Kim S. Andreasen
              last edited by

              I believe that the problem is the ANSI codepage 1252 in Win10 and 65001 in Win11.
              But where do they come from and how can I change 65001 to 1252?

              PeterJonesP 1 Reply Last reply Reply Quote 1
              • PeterJonesP
                PeterJones @Kim S. Andreasen
                last edited by

                @Kim-S-Andreasen said in N++ opens ANSI file incorrectly in Win11 - why?:

                I believe that the problem is the ANSI codepage 1252 in Win10 and 65001 in Win11.

                Yes, that is almost definitely what is going on. If your Win11 codepage is 65001, that means Win11 is using unicode internally, not one of the ANSI pages. So Notepad++ will see that, and try to interpret all ANSI pages as UTF-8, which means that the F8 byte (which in 1252 is ø) is being misinterpreted as a bad UTF-8 enocoded sequence (expecting multiple bytes > 7F but only getting the single F8).

                But where do they come from

                Some installations of Win11 now come pre-installed with the codepage at 65001. Except for the unfortunate people (like you) who still have to deal with files encoded in the ancient 8-bit codepages, despite decades of Unicode being widely available on all modern platforms, it’s really best to set up new Windows systems to default to 65001

                how can I change 65001 to 1252?

                Start Menu > Settings > Time & Language > Language & Region, scroll down to the Related Settings where you will find Administrative language settings. This pops up a dialog that has a section Language for non-Unicode programs. I believe yours is set right now with a checkmark for ☑ Beta: Use Unicode UTF-8 for worldwide language support. If you un-checkmark that, and ok/apply that new setting, then restart, the next time you run Notepad++, it should show Current ANSI codepage: 1252 and work like your Windows 10 installation. But note that this means that other apps might change their behavior unexpectedly.

                Kim S. AndreasenK 1 Reply Last reply Reply Quote 1
                • Kim S. AndreasenK
                  Kim S. Andreasen @PeterJones
                  last edited by

                  @PeterJones
                  Thank you very much.
                  Yes, it seems to work now - hurrah!

                  The funny thing is that I have tried many times to check and uncheck that Language for non-Unicode programs setting without any effect. But I have also changed many other things along the way, for example also changed the Current system locale back and forth to/from Danish (Denmark) to English (United States) with no effect.

                  Moreover, it does not explain why my Win11 suddenly started to behave differently (i.e. using 65001 instead of 1272) without any other changes being made. Well, there are always Windows updates coming in, and I suspect one of them to be the culprit.

                  Just before I saw your post I took a deep breath and ran a complete repair of my Win11 installation. It did not fix the problem itself, but I am convinced that it enabled your suggested change to have the desired effect - which it did not have previously.
                  I hope we can close the case now.

                  Thanks again for your help!

                  1 Reply Last reply Reply Quote 1
                  • CoisesC
                    Coises
                    last edited by

                    @Kim-S-Andreasen, @PeterJones:

                    I believe there is a bug behind this behavior. Reported as Issue #17057.

                    Kim S. AndreasenK 1 Reply Last reply Reply Quote 1
                    • Kim S. AndreasenK
                      Kim S. Andreasen @Coises
                      last edited by Kim S. Andreasen

                      @Coises
                      Great, thanks.
                      I would also like to see an option when opening a file to select whether it should be considered an ANSI file or a UTF-8 file, and if ABSI also which codepage to use. During the last few eeeks I have encountered many situations in which NP++ guesses wrongly, but in which I know what it should have chosen.
                      As a workaround for the code page problem I had to convert a large number of ANSI files to UTF-8. I could not use NP++ because it opened the files using the wrong cp. I had to write an APL program to do the conversion.

                      PeterJonesP CoisesC 2 Replies Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @Kim S. Andreasen
                        last edited by

                        @Kim-S-Andreasen said in N++ opens ANSI file incorrectly in Win11 - why?:

                        I would also like to see an option when opening a file to select whether it should be considered an ANSI file or a UTF-8 file. During the last few eeeks I have encountered many situations in which NP++ guesses wrongly, but where I know what it should have chosen.

                        Under the conditions (1) Windows 's ☐ Beta: Use Unicode UTF-8 for worldwide language support option is unchecked, and (2) Notepad++'s Settings > Preferences > MISC > ☐ Autodetect character encoding is unchecked, then if Notepad++ guesses wrong between UTF-8 and ANSI, you can just change the Encoding menu to one of the other options above the line: For example, if it detects as UTF-8, you can change it to ANSI and it will use the default Windows codepage for interpreting the bytes; or, vice versa, if it detects as ANSI but you know it’s UTF-8, you can pick that encoding; or even, if it detects ANSI but the codepage is wrong, you can use one of the entries in the Character Sets submenu to pick the right character set for the 8bit encoding.

                        So when the two conditions above are met, then you can correct Notepad++'s incorrect interpretation of a given file. When (1) is not true, as you saw, then trying to force it won’t help, because what Notepad++ is calling ANSI is 65001 under the hood, so Notepad++ is just trying to switch between two independently-named UTF-8 modes without realizing it. Instead, when (2) is not true, then when Notepad++ tries to re-interpret the bytes when it re-reads, it again does the auto-detection, and incorrectly uses its bad guess again (as discussed recently in another topic).

                        If the developer and/or other volunteers are able to fix both Issue #17057 and Issue #17033, then hopefully it will always be possible to correct a badly-interpreted file; until then, those two conditions apply in order to be able to fix a mis-identification.

                        1 Reply Last reply Reply Quote 1
                        • CoisesC
                          Coises @Kim S. Andreasen
                          last edited by

                          @Kim-S-Andreasen said in N++ opens ANSI file incorrectly in Win11 - why?:

                          @Coises
                          I would also like to see an option when opening a file to select whether it should be considered an ANSI file or a UTF-8 file. During the last few weeks I have encountered many situations in which NP++ guesses wrongly, but where I know what it should have chosen.

                          You can fix that, even though Notepad++ doesn’t ask.

                          As soon as you open the file, before doing any edits, select the proper encoding from the top section of the Encoding menu (not the Convert section).

                          If you have the Windows setting to use UTF-8 by default checked, ANSI is useless/meaningless in Notepad++. (ANSI means the system default code page, and with that setting checked, ANSI is UTF-8. Notepad++ just doesn’t cope with that very well.) However, in the case you described, selecting Encoding | Character sets | Western European | Windows-1252 would work.

                          Kim S. AndreasenK 1 Reply Last reply Reply Quote 1
                          • Kim S. AndreasenK
                            Kim S. Andreasen @Coises
                            last edited by

                            @Coises
                            Thanks, but I am pretty sure that I have tried that without success,
                            Perhaps the reason it didn’t work is that I probably had the ‘Use Unicode UTF-8 for worldwide language support’ checked, which according to @Peter Jones would invalidate the solution.

                            Thanks a lot to both of you for valuable and knowledgeable support!

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors