Community
    • Login

    Different encoding determined based on the file extension

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 695 Views 1 Watching
    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.
    • Joe SchmitzJ Offline
      Joe Schmitz
      last edited by

      I have an xml file which is encoded ISO-8859-1.
      With a file extension of .XML, Notepad++ shows encoding as ISO-8859-1
      If I remove the file extension, Notepad++ shows the encoding as ANSI

      Is this a bug that can be fixed?

      Notepad++ v8.1.9.3 (32-bit)
      Build time : Dec 6 2021 - 19:16:45
      Path : C:\Program Files (x86)\Notepad++\notepad++.exe
      Command Line :
      Admin mode : OFF
      Local Conf mode : OFF
      Cloud Config : OFF
      OS Name : Windows 10 Enterprise (64-bit)
      OS Version : 2009
      OS Build : 19044.1645
      Current ANSI codepage : 1252
      Plugins : ComparePlugin.dll DSpellCheck.dll HexEditor.dll mimeTools.dll NppConverter.dll NppExport.dll NPPJSONViewer.dll XMLTools.dll

      EkopalypseE 1 Reply Last reply Reply Quote 0
      • EkopalypseE Offline
        Ekopalypse @Joe Schmitz
        last edited by

        @joe-schmitz

        No, this is not an error. Some files like xml or html sometimes provide a tag that Npp uses to identify the encoding. If this is not present or Npp does not know that it is an XML or HTML file, it tries to guess the encoding using the chardet module.
        So it works as intended. By the way, in this particular case, ISO-8859-1 and your ANSI version (1252) are identical.

        1 Reply Last reply Reply Quote 3

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors