#444 Copy truncates string at null byte

Next_major_release
closed
nobody
None
1
2014-08-24
2013-01-09
Vivian De Smedt
No

The problem

I use Notepad++ to look at data. Notepad++ is able to load files with embedded null character. But if I copy a string with an embedded null character and paste it within another document or in another editor (Notepad, UltraEdit, Excel) it strips everything after the null character.

This is of course a bit confusing and at first glance looks like a bug.

What other text editors (Notepad, UltraEdit) do in such situation is to replace the null character 0x00 by a space 0x20 when filling the clipboard.

This solution is not perfect because the copy is then not identical to the original but:
- most of the copy is not stripped and
- most of the content is correct.

The solution

The weakness is not in Notepad++ but in Scintilla I submit a patch to the maintainer of Scintilla (Neil Hodgson) and it has now been merged into Scintilla.

Scintilla Bug #1289

In attachment you'll find a patch which is just a "copy" of what have been done in Scintilla.

Please don't hesitate to tell me how I can improve my contribution to help you to merge it into Notepad++

Best regards,
Vivian.

1 Attachments

Related

Patches: #444

Discussion

  • Don HO
    Don HO
    2013-01-27

    • status: open --> closed
    • priority: 5 --> 1
     
  • Don HO
    Don HO
    2013-01-27

    There is already a feature (3 commands) in Notepad++:
    Menu Edit->Paste Special->Copy/Cut/Past Binary Content
    Have you ever tried it?

    Don

     
  • Don,

    Thanks for your answer.
    I wasn't aware of the three commands.

    I like that patch because I can still use the classic keyboard shortcuts and have a very reasonable result.

    Do you have any plan to use the last version of Scintilla in Notepad++?

    Yours,
    Vivian.

     
  • Don,

    I have tried the three commands but they don't help to be able to copy text with NUL from Notepad++ to other programs (e.g. Excel)

    Yours,
    Vivian.

     
    • Don HO
      Don HO
      2013-11-30

      Sorry I didn't see your comment until today.
      Notepad++ has updated new version of Scintilla since v6.5.
      This issue is solved obviously.

      Don

       
      • Thanks for your message :-)

        On Saturday, November 30, 2013, Don HO wrote:

        Sorry I didn't see your comment until today.
        Notepad++ has updated new version of Scintilla since v6.5.
        This issue is solved obviously.

        Don

        Status: closed
        Created: Wed Jan 09, 2013 10:38 AM UTC by Vivian De Smedt
        Last Updated: Mon Jan 28, 2013 03:54 PM UTC
        Owner: nobody
        The problem

        I use Notepad++ to look at data. Notepad++ is able to load files with
        embedded null character. But if I copy a string with an embedded null
        character and paste it within another document or in another editor
        (Notepad, UltraEdit, Excel) it strips everything after the null character.

        This is of course a bit confusing and at first glance looks like a bug.

        What other text editors (Notepad, UltraEdit) do in such situation is to
        replace the null character 0x00 by a space 0x20 when filling the clipboard.

        This solution is not perfect because the copy is then not identical to the
        original but:
        - most of the copy is not stripped and
        - most of the content is correct.
        The solution

        The weakness is not in Notepad++ but in Scintilla I submit a patch to the
        maintainer of Scintilla (Neil Hodgson) and it has now been merged into
        Scintilla.

        Scintilla Bug #1289 http://sourceforge.net/p/scintilla/bugs/1289/

        In attachment you'll find a patch which is just a "copy" of what have been
        done in Scintilla.

        Please don't hesitate to tell me how I can improve my contribution to help
        you to merge it into Notepad++

        Best regards,
        Vivian.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/notepad-plus/patches/444/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         

        Related

        Patches: #444