• Login
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.5k 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.
  • R
    Ramon Beiboer
    last edited by Ramon Beiboer Oct 28, 2019, 11:16 AM Oct 28, 2019, 11:14 AM

    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

    E A 2 Replies Last reply Oct 28, 2019, 11:32 AM Reply Quote 0
    • E
      Ekopalypse @Ramon Beiboer
      last edited by Ekopalypse Oct 28, 2019, 11:32 AM Oct 28, 2019, 11:32 AM

      @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?

      R 1 Reply Last reply Oct 28, 2019, 12:16 PM Reply Quote 0
      • A
        Alan Kilborn @Ramon Beiboer
        last edited by Oct 28, 2019, 11:54 AM

        @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
        • R
          Ramon Beiboer @Ekopalypse
          last edited by Oct 28, 2019, 12:16 PM

          @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)

          A 1 Reply Last reply Oct 28, 2019, 12:24 PM Reply Quote 2
          • G
            guy038
            last edited by guy038 Oct 28, 2019, 12:21 PM Oct 28, 2019, 12:20 PM

            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
            • A
              Alan Kilborn @Ramon Beiboer
              last edited by Oct 28, 2019, 12:24 PM

              @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
              • E
                Ekopalypse
                last edited by Oct 28, 2019, 12:29 PM

                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
                • E
                  Ekopalypse
                  last edited by Oct 28, 2019, 12:34 PM

                  Seems like Copy/PasteBinary has its origin here .

                  R 1 Reply Last reply Oct 28, 2019, 12:50 PM Reply Quote 2
                  • R
                    Ramon Beiboer @Ekopalypse
                    last edited by Oct 28, 2019, 12:50 PM

                    @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
                    8 out of 9
                    • First post
                      8/9
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors