Community
    • Login

    Non printable characters are replaced by space characters when copied, how to prevent that from happening?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 4 Posters 1.4k 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.
    • Ramon BeiboerR
      Ramon Beiboer
      last edited by Ramon Beiboer

      Hi,

      I am trying to edit files that are stored in a custom file format in Notepad++. The format of the files files is not really a text-format, but it has some similarities and Notepad++ is able to display the contents very nicely. I turn on the option to show all characters, so that I can easily see the difference between text characters and other characters that make up te file.
      I do have a problem when copying data around in the editor. When I select a part of the file that contains non-printable characters (with value < 32), these characters will be replaced with a space character (value 32) when pasted somewhere else in the editor. I do not want that, I want the data to be copied without any changes. Is that possible with Notepad++? I did not find an option yet that can do this.

      Ramon

      EkopalypseE Alan KilbornA 2 Replies Last reply Reply Quote 0
      • EkopalypseE
        Ekopalypse @Ramon Beiboer
        last edited by Ekopalypse

        @Ramon-Beiboer

        doesn’t seem to happen for me.
        Which npp version do you use? (can be found as debug-info from last menu item the ? menu)

        Can you provide some sample doc/text?

        Ramon BeiboerR 1 Reply Last reply Reply Quote 0
        • Alan KilbornA
          Alan Kilborn @Ramon Beiboer
          last edited by

          @Ramon-Beiboer

          The Edit menu’s Paste Special submenu has some options for copy/paste of binary content. Maybe try these and see if there is any difference?

          1 Reply Last reply Reply Quote 2
          • Ramon BeiboerR
            Ramon Beiboer @Ekopalypse
            last edited by

            @Alan-Kilborn It looks like the Copy Binary Content and Paste Binary Content commands do the trick! You have to use both binary versions of the copy and paste commands, otherwise it will not copy everything, or mess up the data. I now wonder if this has to do with how the application stores the copied data in the clipboard.
            @Ekopalypse I am using Notepad++ v7.5.6 (64 bit)

            Alan KilbornA 1 Reply Last reply Reply Quote 2
            • guy038G
              guy038
              last edited by guy038

              Hello, @ramon-beiboer, @alan-kilborn and All,

              Yes, Alan is perfectly right about it :-)) I’ve just tried it, opening the notepad++.exe executable file, …in N++, then doing a correct Copy/ Paste operation in a new tab

              • First of all, verify that the part of file to be copied and your new tab have the same encoding

              • Copy your data, using the Edit > Paste Special > Copy Binary Content option

              • Paste your data, in the new tab, using Edit > Paste Special > Paste Binary Content option

              Et voilà :-))

              Best Regards,

              guy038

              1 Reply Last reply Reply Quote 1
              • Alan KilbornA
                Alan Kilborn @Ramon Beiboer
                last edited by

                @Ramon-Beiboer said in Non printable characters are replaced by space characters when copied, how to prevent that from happening?:

                I now wonder if this has to do with how the application stores the copied data in the clipboard

                Probably a Scintilla thing. Scintilla often does what it thinks is the “safe” thing with clipboard data.

                Another example is when pasting line-endings. It will paste line-endings appropriate for the current document, regardless of what type of line-endings are in the clipboard. Scintilla is configurable in this regard, but when Notepad++ sets it up, it doesn’t alter this behavior.

                1 Reply Last reply Reply Quote 1
                • EkopalypseE
                  Ekopalypse
                  last edited by

                  It seems the NULL char is the problem and now I remember that I read
                  somewhere that scintilla handles this differently because of the issue
                  that C-Strings a NULL terminated or so (not 100% sure)

                  1 Reply Last reply Reply Quote 3
                  • EkopalypseE
                    Ekopalypse
                    last edited by

                    Seems like Copy/PasteBinary has its origin here.

                    Ramon BeiboerR 1 Reply Last reply Reply Quote 2
                    • Ramon BeiboerR
                      Ramon Beiboer @Ekopalypse
                      last edited by

                      @Ekopalypse Thanks for looking this up. It makes more sense now. I now assigned some keyboard shortcuts to the binary copy and paste commands.

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