Bug 232671

Summary: can not edit binary file
Product: [Applications] kate Reporter: Rik Theys <rik.theys+kde>
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: christoph, rik.theys+kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rik Theys 2010-03-30 11:27:14 UTC
Version:           4.4.1 (KDE 4.4.1) (using 4.4.1 (KDE 4.4.1), 4.4.1-6.fc12 Fedora)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.32.10-92.fc12.x86_64

I started kwrite with the file to open as the parameter. Kwrite opened with the file loaded but I could not edit the file: can't insert characters or remove any.

When I opened the file from the menu, it displays a dialog that says I'm opening a binary file and that saving it will result in a corrupt file.

1) This dialog should also appear when I open the file from the command line.
2) Is it normal I can't edit the file because it's binary? I don't think kwrite should prevent me from doing that?
Comment 1 Rik Theys 2010-03-30 11:30:09 UTC
Same thing happens in kate, but I assume this is to be expected.
Comment 2 Andreas Pakulat 2010-03-30 12:57:08 UTC
(In reply to comment #0)
> 2) Is it normal I can't edit the file because it's binary? I don't think kwrite
> should prevent me from doing that?

Yes it should, editing a binary file with a _plain text_ editor doesn't make the slightest sense. Kate is not a hex editor, you can use okteta for that.
Comment 3 Rik Theys 2010-03-30 13:08:59 UTC
The file I was trying to open was a text file with a few binary characters in it. Kwrite should tell me that it's binary and that I can only view the file.

The open dialog warns me about the file being binary and says that it will get corrupted if I save it. But I can't change the file. So either the dialog should  say that the file is read-only because it's binary, or keep the current message and allow me to shoot myself in the foot by changing it.
Comment 4 Matthew Woehlke 2010-03-31 02:03:23 UTC
You can turn off read-only: tools -> read only mode.

Maybe the wording on the warning can be better?
Comment 5 Rik Theys 2010-03-31 07:56:14 UTC
Yes, I think the wording could be changed to say that the file is currently opened read-only because it's binary and that you can turn it read-write in the tools menu.

The warning should also appear when kwrite is started with the filename as a parameter and not only when the file is opened using the file-> open dialog.

Maybe the title bar (or status bar) could say [read-only] when read-only mode is on like the way it also says [modified] when there are unsaved changes?
Comment 6 Christoph Cullmann 2011-06-24 21:01:17 UTC

*** This bug has been marked as a duplicate of bug 154897 ***