XPost: comp.mobile.android, comp.editors
On 07.02.2025 06:57, Lawrence D'Oliveiro wrote:
On Thu, 6 Feb 2025 23:58:04 +0100, Carlos E.R. wrote:
On 2025-02-06 21:57, Lawrence D'Oliveiro wrote:
I have done direct editing of binary data in Emacs.
And I have done so in MsDOS times with primitive text editors, just
because that was what I had. To change some string.
Did they preserve null characters in the file?
Cannot tell for MS DOS environments, but why is that "binary" editing noteworthy in the first place? - Though I may be spoiled by using Vim
where you can of course also operate on files containing any control
characters (including ASCII NUL).
The likely more interesting thing is probably to provide more advanced
features in _dedicated_ hex editors. - I recall some tools where you
could edit either the hex values (on the left part of the screen) or
its string representation (on the right part of the screen). It would
also make sense to navigate on the binary text in units of "bytes" and
"byte" offsets.
In Vim, for example, you either edit the string texts directly. Or use
any transform tool prior (typical is 'xxd') to operate on hex values.[*]
(This is of course simple since you just put the respective Vim command
on some key, to switch to/from hex representation.[**])
In that respect the poster is correct that you operate on text anyway,
whether it's the original text (with control characters like NUL) or
a transformed text (with a hex layout). - But again; a dedicated "hex
editor" tool might have advantages; it could show data in more than
one representation, navigate in the binary file more sensibly, etc.
At least for Vim the distinction between "text" and "binary" files is nonetheless not that important, at least if you are just concerned
about control characters.[***]
Janis
[*] But note that editing the _informative strings_ in hex mode won't
change the file; in 'xxd' based hex-mode you have to edit the _hex_
value so that the contents are changed. (There's the difference from
such more powerful hex editors I mentioned above.)
Note also that since the "hex-mode" is not a built-in mode in Vim you
can use arbitrary hex transformation tools. But 'xxd' is the commonly
used tool with Vim; with that tool you can (for example) also display
files as binary information, but strangely the function to revert the
format to store it isn't possible ("sorry, cannot revert this type of hexdump"), which is particularly sad since it would be so simple to
have it supported by 'xxd'.
[**] Makes sense in case you do such hex-editing regularly. (I don't
need that feature; had used it in decades probably only once.)
[***] For, say, media data files you'd anyway use some media-specific
(domain specific) "editor".
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)