Not a bug: Copy&Paste limited to 2MiB (when pasting to external applications)

Bug reports concerning HxD.
Post Reply
user4589
Posts: 4
Joined: 27 Sep 2017 22:51

Not a bug: Copy&Paste limited to 2MiB (when pasting to external applications)

Post by user4589 »

When I copy the hexadecimal or ansi code of any file from HxD, I can only past half of the code to other programs!

Is this a bug? How can I paste all the code to other programs? Thanks!
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Copy/Paste issue! (Seems to be a bug!)

Post by Maël »

As mentioned in my mail:

What do you mean by half the code?
Please provide an example of what you copy (screenshot) and what you get when you paste (and what you would expect to happen instead).

What version of HxD do you use btw?

Regards,
Maël
user4589
Posts: 4
Joined: 27 Sep 2017 22:51

Re: Copy/Paste issue! (Seems to be a bug!)

Post by user4589 »

.
.
the issue happens in version 1.7.7.0 and 2.0!
.
.
1_ select all and copy.png
1_ select all and copy.png (35.05 KiB) Viewed 5201 times
2_ paste the code in notepad - incomplete.png
2_ paste the code in notepad - incomplete.png (37.75 KiB) Viewed 5201 times
3_ missing codes.png
3_ missing codes.png (53.71 KiB) Viewed 5201 times
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Copy&Paste limited to 2MiB (when pasting to external applications)

Post by Maël »

There is a limit of how much you can copy and paste, because the Windows clipboard can handle only so much data without slowing the system down. This limit is set to a 2MiB block length, no matter if you are in the hex or text column.

In the Windows clipboard this data will blow up to a multiple of its original size, because of the necessary conversions done by HxD and the internal conversions Windows does. For example, hex values will be at least 3 times the size because 1 byte is 2 hex chars plus a space; if you add to this the UTF-16 encoding of the Windows clipboard, this goes up to at least 6 times the original size.

The other reason is that Notepad already starts to get really slow when pasting so much data. Text editors in general are not good at handling so much text, and many text entry fields will limit the text to much less than 2 MiB.

If you need to copy and paste larger chunks, you can do so within HxD (HxD has an internal clipboard), and the entire block will be copied and pasted (given you have enough memory, but you get an error message if you don't).

To circumvent this limit, you can copy the data in chunks, or you can use File|Export|Editor view.

Why do you need to copy so much data to the clipboard? Usually the point is copying a hex dump to display it in a webpage, a slide, or similar locations for viewing purposes of a short block. So a very long hex dump wouldn't be of much use, as it's unlikely anybody would read pages of hex values. If you want to process data, it is more sensible to open the binary file itself in the target application (instead of going over the Windows clipboard).

If you tell me the purpose of copying so much data outside of HxD, I may find another way to implement this.
user4589
Posts: 4
Joined: 27 Sep 2017 22:51

Re: Copy&Paste limited to 2MiB (when pasting to external applications)

Post by user4589 »

Oh, it's limit to 2MB ...

"Export File", should have the options below:
- Export Hex code only in 1 line, with or without "space" characters! (with "space" chars: in pairs of 2, or pairs of 3, or pairs of 4, and so on ...!)
- Export Text only!

"open the binary file itself in the target application" may be the best option to go, but I will have to learn first how to do that!

I just wrote a small and portable application that can Encrypt/Compact and Decrypt/Uncompact the binary or hex code of any file!
- it can convert bin to hex, or hex to bin
- it can set pairs format, example:
- ABCDEF0123456789 to AB CD EF 01 23 45 67 89 or to ABCD EF01 2345 6789 and so on ...
- 0010100001010101 to 00 10 10 00 01 01 01 01 or to 0010 1000 0101 0101 and so on ...

(I wrote the application just for fun, it is nothing professional!)
user4589
Posts: 4
Joined: 27 Sep 2017 22:51

Re: Copy&Paste limited to 2MiB (when pasting to external applications)

Post by user4589 »

Hi @Maël ,

This is the application I was talking about the other day:

BinHex CryPactor Video Link

The video shows some Binary and Hexadecimal string manipulation (simple and basic Encryption/Decryption)

I really don't know if the application can possibly be useful for anything at all, but I decided to make it public anyway!

Image
Maël
Site Admin
Posts: 1455
Joined: 12 Mar 2005 14:15

Re: Copy&Paste limited to 2MiB (when pasting to external applications)

Post by Maël »

Thanks for posting this app.
Post Reply