You are here: PSPad forum > Bug report / Hlášení chyb > Bug on editing mixed text/bin file (v4.6.0, 2700)

Bug on editing mixed text/bin file (v4.6.0, 2700)

#1 Bug on editing mixed text/bin file (v4.6.0, 2700)

Posted by: Thinner | Date: 2016-03-10 22:18 | IP: IP Logged

Hi,

I want to edit a text file (DOS, CR+LF) with a binary footer containing a CRC32 checksum.

File is opened in text mode by default. If switching to hex mode manually and editing CRC32 containing byte 0x0D and saving file, mode is switched back to text and the byte 0x0D is replaced by 0x0D 0x0A (CR+LF).

Example:
1. Create a new file in text mode (DOS, CR+LF):
aaaa
bbbb

2. Switch to hex mode and append bytes:
01 02 0D 03

3. Save the file

mode will switch back to text
switching back to hex mode manually you will see:

01 02 0D 0A 03

Any chance to get that fixed?

BTW: It would be nice to see the number of selected bytes in hex mode in hexadecimal too, currently it's only decimal.

Thanks for this great tool.

wbr
Thinner

Options: Reply | Quote | Up ^


#2 Re: Bug on editing mixed text/bin file (v4.6.0, 2700)

Posted by: vbr | Date: 2016-03-10 23:06 | IP: IP Logged

Thinner:
Hi,

I want to edit a text file (DOS, CR+LF) with a binary footer containing a CRC32 checksum.

File is opened in text mode by default. If switching to hex mode manually and editing CRC32 containing byte 0x0D and saving file, mode is switched back to text and the byte 0x0D is replaced by 0x0D 0x0A (CR+LF).

Example:
1. Create a new file in text mode (DOS, CR+LF):
aaaa
bbbb

2. Switch to hex mode and append bytes:
01 02 0D 03

3. Save the file

mode will switch back to text
switching back to hex mode manually you will see:

01 02 0D 0A 03

Any chance to get that fixed?

BTW: It would be nice to see the number of selected bytes in hex mode in hexadecimal too, currently it's only decimal.

Thanks for this great tool.

wbr
Thinner

Hi,
I am not sure, I fully understand the intention and the described workflow, but I believe, if you switch a textual file to hexadecimal view in PSPad, you may not get the original binary content - there are some internal conversions of the text involved (probably utf-16) and the switched view can only display this converted version.

On the other hand, if you use File: Open in Hex edit, you get the original saved data without conversions.

hth,
vbr

Options: Reply | Quote | Up ^


#3 Re: Bug on editing mixed text/bin file (v4.6.0, 2700)

Posted by: pspad | Date: 2016-03-11 06:36 | IP: IP Logged

Open your file directly in PSpad HEX editor, not as text

Options: Reply | Quote | Up ^


#4 Re: Bug on editing mixed text/bin file (v4.6.0, 2700)

Posted by: Thinner | Date: 2016-03-11 22:27 | IP: IP Logged

Hi vbr,

Thanks for your fast reply. I'm sure you got it right. smiling smiley
I didn't know that there is a difference between "Open in HEX Editor" and "View / HEX Edit Mode". I'm using PSPad as default editor in combination with TotalCommander (TC), so hitting F4 in TC will open the selected file in PSPad. Up to now i haven't had any problems, textual files are opened in text mode, binary files in hex mode. If necessary i used "View / HEX Edit Mode" to switch. This has worked for years, but not in this special case of "mixed" textual/binary file. Never mind, i got the workaround smiling smiley

wbr
Thinner

Options: Reply | Quote | Up ^


#5 Re: Bug on editing mixed text/bin file (v4.6.0, 2700)

Posted by: Thinner | Date: 2016-03-11 22:29 | IP: IP Logged

pspad:
Open your file directly in PSpad HEX editor, not as text

Hi,

Thanks for your reply, i will do that in future, didn't know that there is a difference between "Open in HEX Editor" and "View / HEX Edit Mode".

wbr
Thinner

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2021 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR