Community
    • Login

    Standard ANSI and code still change to something else

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    13 Posts 4 Posters 148 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.
    • PeterJonesP
      PeterJones @NolanNolan
      last edited by PeterJones

      @NolanNolan said in Standard ANSI and code still change to something else:

      @PeterJones
      Thanks i disabled auto detect just in case, but what i observed now was after a reboot it seemed to work as expected again.

      Glad that helped.

      … windows search nor copernic desktop search can find any file with letters æ,ø,å because its interpreted as letters not being æ,ø,å. This i assume is dictated by the OS, which is from 2025.

      I guesss I’d never tried using Windows search to look for UTF-8 characters. That’s really annoying if they don’t handle that right. You’d think Microsoft would’ve figured that out long ago.

      This is both annoying and very weird.

      Understandable.

      Any explanation or proper solution to this ?

      Sorry, I have no insight into the OS level searches.

      Nor do I have a proper solution. But, as an alternate workaround, instead of using Windows Search, use Notepad++'s Find in Files to search your files for UTF-8 characters? ;-)


      BTW: You didn’t need to make that post twice. As the form tells you: until you have enough reputation/upvotes, you need to wait for a moderator to approve your post, so it won’t be visible immediately, so that’s why you couldn’t see your post. However, it looks like you now have enough upvotes so that your posts will go thru without moderator approval, so you shouldn’t have to wait for the post queue any more.

      N 1 Reply Last reply Reply Quote 0
      • CoisesC
        Coises @NolanNolan
        last edited by

        @NolanNolan said in Standard ANSI and code still change to something else:

        use Danish Windows 11 Pro 25H2 ie the latest version, and if i create a txt file with the build in notepad.exe application which uses UTF-8 and write the danish characters æ,ø,å then windows search nor copernic desktop search can find any file with letters æ,ø,å because its interpreted as letters not being æ,ø,å. This i assume is dictated by the OS, which is from 2025. If i save txt files in ANSI windows search and copernic perfectly finds txt files with the letters æ,ø,å, but not if saved in UTF-8.

        Try saving (whether in Notepad or Notepad++) as UTF-8 with BOM. In the absence of a byte order mark, Windows assumes files use the legacy code page associated with the system locale.

        N 2 Replies Last reply Reply Quote 1
        • N
          NolanNolan @PeterJones
          last edited by

          @PeterJones
          thanks Peter, your help was again very helpful and insightfull, much appreciated :-)

          best Nolan

          1 Reply Last reply Reply Quote 0
          • N
            NolanNolan @Coises
            last edited by NolanNolan

            @Coises

            Yes you are indeed right, i just picked ANSI as the first option which was a work around solution for windowsx search to find æøå as content in txt files, but tested UTF-8 BOM and this format also works but UTF_8 without BOM does not work. Thanks for your suggestion, that will be a more modern and my default code from hereon.

            But really weird that using Microsofts own notepad.exe that comes with a standard windows installation makes windows search not detect characters in txt files that belongs to the installation language of the OS.

            I have also tried to find a solution to set the txt coding, system wide in the OS, but couldnt find any. SO i guess the way to go is to default UTF-8 BOM through the NOtepad++ app (by the way this even cant be set in the native microsoft notepad.exe app)

            Thanks :-)

            best Nolan

            1 Reply Last reply Reply Quote 1
            • N
              NolanNolan @Coises
              last edited by NolanNolan

              @Coises

              i now changed the coding to UTF-8 BOM, assuming this sets the default for all new txt files, but new files are still created as ANSI, when i right click empty space in file explorer and create new. But when i open NOtepad++ as an app it is opening with default UTF-8 BOM as expected, have i missed something regarding a setting ?

              5dc26c2f-b1ba-41a2-b8af-66fb86798dcb-image.png

              best Nolan

              CoisesC 1 Reply Last reply Reply Quote 1
              • Thomas AndersonT
                Thomas Anderson
                last edited by

                Notepad++ auto-detects encoding based on the characters you type. When you enter Danish letters like æ, ø, å, these aren’t part of standard ANSI, so Notepad++ switches to a code page that can support them (like Windows-1252 or sometimes misdetects as 1255).

                To always save in ANSI:

                Go to Settings → Preferences → New Document → Encoding.

                Select ANSI as the default.

                Check “Apply to opened ANSI files” if available.

                Note: Some characters (like æøå in certain ANSI pages) may not display correctly in pure ANSI — using Windows-1252 is safer for Western European letters.

                This ensures new files default to ANSI, but remember Notepad++ may still switch if characters aren’t supported in that code page.

                N PeterJonesP 2 Replies Last reply Reply Quote -1
                • CoisesC
                  Coises @NolanNolan
                  last edited by

                  @NolanNolan said in Standard ANSI and code still change to something else:

                  i now changed the coding to UTF-8 BOM, assuming this sets the default for all new txt files, but new files are still created as ANSI, when i right click empty space in file explorer and create new.

                  When you create a new .txt file from Windows Explorer | right-click | New | … Windows creates an empty file with the .txt extension.

                  By definition, UTF-8 with BOM means a file that begins with a UTF-8 byte order mark. An empty file, of course, doesn’t begin with anything, so it can only be either an ANSI file or a UTF-8 (no BOM) file.

                  That all makes perfect sense if you think like a computer, and no sense if you think like a human being.

                  If you are brave, it is possible to change this behavior by editing the registry. (If “edit the registry” means nothing to you, I’m going to suggest that you stop right here and avoid potentially messing up your system. If you know how to edit the registry, read on.)

                  First, open Notepad++ and save a new, empty file as UTF-8 with BOM using a name with a .txt extension. Choose a place to store it where it won’t be disturbed. Remember the full path and name of the file.

                  Open regedit and locate HKEY_CLASSES_ROOT\.txt\ShellNew. Delete the value NullFile. Create a new String Value named FileName, then edit it to set its value to the full path and name of the file you saved.

                  Now, when you create a new .txt file, instead of being empty, it will contain a UTF-8 byte order mark.

                  Reference:
                  https://learn.microsoft.com/en-us/windows/win32/shell/context#extending-the-new-submenu

                  N 1 Reply Last reply Reply Quote 1
                  • N
                    NolanNolan @Coises
                    last edited by NolanNolan

                    @Coises

                    thanks, yes that worked perfectly, although it seems not to use the full path just the filename is to be used

                    thanks again :-)

                    best Nolan

                    1 Reply Last reply Reply Quote 0
                    • N
                      NolanNolan @Thomas Anderson
                      last edited by

                      @Thomas-Anderson

                      Thanks Thomas

                      who would have thought it could be so cumebersome to make a simple txt file work in modern windows

                      Thanks again :-)

                      best Nolan

                      1 Reply Last reply Reply Quote 0
                      • PeterJonesP
                        PeterJones @Thomas Anderson
                        last edited by PeterJones

                        @Thomas-Anderson said in Standard ANSI and code still change to something else:

                        Notepad++ auto-detects encoding based on the characters you type.

                        Please don’t make false claims like that. It doesn’t help anyone.

                        When you enter Danish letters like æ, ø, å, these aren’t part of standard ANSI,

                        You really don’t understand encoding. You probably shouldn’t be giving advice in such a conversation. (Update: Specifically, as I described above, “ANSI” is a misnomer, and when Notepad++ is using ANSI, it’s really using the default codepage for your installation of Windows, so for some people, who have set Windows to a Danish localization, or another localization that uses a Dutch-compatible character set, the “ANSI” selection in Notepad++ will know the Danish letters.) (Update 2: Besides, Windows-1252 encoding does have æ, ø, å, at codepoint 230, 248, and 229,respectively. And since Windows-1252 is what the vast majority of US and Western Europeans have their Windows set to accommodate, “ANSI” for all of those people will include those characters.)

                        so Notepad++ switches to a code page that can support them (like Windows-1252 or sometimes misdetects as 1255).

                        That’s not what Notepad++ does. Update: it follows the settings, as described in my post above, when you create a new file, regardless of what you type; however, when you open an existing file, it will use heuristics to guess the encoding, but that has nothing to do with typing.

                        To always save in ANSI:
                        Go to Settings → Preferences → New Document → Encoding.
                        Select ANSI as the default.
                        Check “Apply to opened ANSI files” if available.

                        This proves you don’t know what you’re talking about. The Apply to opened ANSI files is only available for the UTF-8 option.

                        Note: Some characters (like æøå in certain ANSI pages) may not display correctly in pure ANSI — using Windows-1252 is safer for Western European letters.

                        And if you tried to enter one of those characters while in a file (new or otherwise) under Notepad++'s “ANSI” setting, it would show up as a ?, not as the character. Which proves both your statement here, and the line above where you claimed Notepad++ changes encoding as you type, to be completely fallacious and false and misleading.

                        This ensures new files default to ANSI, but remember Notepad++ may still switch if characters aren’t supported in that code page.

                        Wrong.

                        Nearly everything you said in that post is wrong.

                        Based on this, and the other posts you’ve written, I am coming to the conclusion that you are violating this Forum’s requirement that posts be human-generated, not bot/AI/GPT/LLM-generated. Your posts have always sounded to me like they are LLM/GPT-generated, and this one has pretty much clenched the deal. Please stop spreading AI nonsense. (And if you aren’t using AI, then me believing that you are using AI should tell you something about the quality (or lack thereof) of your posts.)

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