Ubuntu QA:
BlogBrainstormPackage status
Log in
Ubuntu QA
The Ubuntu community has contributed 21986 ideas, 135057 comments, 2615221 votes
Idea sandbox Idea sandbox
Popular ideas Popular ideas
Ideas in development Ideas in development
Implemented ideas Implemented ideas
Idea #9010: Make gedit be able to open any files

Written by Eldmannen the 23 May 08 at 18:50. Category: Others. Related project: Nothing/Others. Status: New
Rationale
Make gedit (the primary text editor in Ubuntu) be able to open any type of file.

When I try to open a binary file or a .png file or something, it whines and says;
* "gedit has not been able to detect the character coding.
Please check that you are not trying to open a binary file."

Well, I would like to be able to open a binary file.
Tags: gedit

160
votes
up equal down
Solution #1: Auto-generated solution of idea #9010
Written by Eldmannen the 23 May 08 at 18:50.
Ubuntu Brainstorm was updated in January 2009. Since the idea #9010 was submitted before this update, its rationale and solution are not separated. Please vote accordingly, and if you have the necessary rights, please separate the rationale from the solution. Thanks!
11
votes
up equal down
Solution #2: Add the option to skip unreadable bytes.
Written by misiu_mp the 21 Aug 09 at 13:09.

In the error pop-up in gedit, add the option to skip unreadable bytes or replace them with a replacement character.
22
votes
up equal down
Solution #3: Add Built-In Hex Editor
Written by Penguin Guy the 29 Aug 09 at 19:10.
Add a built in hex editor and when opening a non-text file let the user select if they want to open it as a text file or a hexadecimal file. Also have a radio list under View -> Format including 'Plain Text', 'Hexadecimal', and 'Binary'.
9
votes
up equal down
Solution #4: Display characters not part of the encoding
Written by arkmundi the 28 Jul 10 at 13:27.
Open the file anyway with a warning that it may not be a text file. Display all characters not part of the encoding set visibly with some special character.
-2
votes
up equal down
Solution #5: Use the power of gedit...
Written by flint the 27 Sep 10 at 11:38.
Write a filter to include in the "tools" section of gedit which would filter non-ascii text. Additionally, this filter would be available when invoked (e.g. "gedit --encoding=failsafe ), and the filter could be invoked to save an adulterated version of the binary - or not.
3
votes
up equal down
Solution #6: Make gedit more tolerant of encoding
Written by geoff07 the 30 Oct 10 at 20:43.
When I open a text file from Windows, gedit often blanks the screen and in a big red banner says it can't open the file.

Yet notepad/Wine in Ubuntu can open these files.

Therefore the files are perfectly open-able by a simple program. So it isn't a problem of unreadable bytes or binary data. So why not by gedit, which is supposed to be the premier editor in Ubuntu?

And please don't expect me as a user to know or want to know anything about character encoding, that is the job of the developers.
5
votes
up equal down
Solution #7: Display anyway, providing options.
Written by orbatos the 13 Feb 11 at 02:57.
gedit should simply display available ASCII characters and perhaps (optionally?) detect newlines and spaces, while blocking out unprintable characters using their control or hex codes like other technical editors (SciTE, VIM).

In addition, if any banner is to be displayed, the document should be visible and the banner should have options like "Ignore" and "Read As:", followed by the encoding menu.

In the event that a hex editor plugin is developed, an encoding option of "Read as Hex" could be added to the encoding menu.

Propose your solution

Attachments


Duplicates


Comments
taron wrote on the 23 May 08 at 19:34
That's not the purpose of a text editor.

But what would be an interesting idea: A program that fetches file type information (text, html, audio, video, picture, binary) and loads a specific backend (like gedit, gecko, gstreamer, ...).

But that's the point where we come to what the Konqueror is, because he can include KParts.

krs wrote on the 23 May 08 at 21:00
Yes, gedit could open binary file in hex mode, with charachet display on the side, this way we can have a look at the characters strings we can found in pictures or video files.

Eldmannen wrote on the 23 May 08 at 21:22
taron,
In Windows I can open *ANY* file in Notepad.
That is nice. I like that.

sisto wrote on the 23 May 08 at 22:04
In the meantime you may use ghex2.
It can edit any kind of files.

brokencrystal wrote on the 23 May 08 at 23:30
Maybe someone could make a gedit binary file viewer plugin available and add it to the repository.

eapache wrote on the 24 May 08 at 00:39
Opening binary files in a text editor is very useful sometimes.

+1

wmwong wrote on the 24 May 08 at 08:20
I'm working on a project myself right now, and it annoys me that I can browse to the folder containing my images, but cannot open them!

+1

Ssdg wrote on the 24 May 08 at 15:29
+1 but for an "hexadecimal mode" with a splited edition panel with hexadecimal left and the character on the right when the text can't be interpreted (because the "MS notepad" way to view binary files suck)

Eldmannen wrote on the 24 May 08 at 16:04
ssdg,
gedit is a text editor, not a hex editor.

hacktick wrote on the 1 Jun 08 at 17:08
maybe a hexeditor-plugin for gedit would be nice?

Endolith wrote on the 9 Sep 08 at 18:56
It should open GHex instead?

unimatrix wrote on the 29 Jun 09 at 12:37
Even notepad can open a binary file. Gedit = FAIL

Hell Pé wrote on the 29 Jun 09 at 13:20
Who's using Gedit or MS Notepad to open a binary file ? Who knows exactly what is a binary file ?

jarvy wrote on the 30 Jul 09 at 19:01
Even though most of the file is unreadable, I like to open a binary file in windows with, say, edit or notepad, to check out any "normal" text. Things like "password", my name spelled out among other things make me suspicious.

jarvy wrote on the 30 Jul 09 at 19:03
sorry. not edit but jedit

misiu_mp wrote on the 21 Aug 09 at 12:59
Definitely a good idea. Inability of gedit to open files containing zoros is the single most annoying "feature" of gedit.
Some text files might get corrupted and filled with zeros making gedit is no longer able to open them at all. This is possible after a hard system crash when the filesystem is trying to recover.
Another scenario is when recovering files with ddrescue. It pads read errors with zeros.
It is useful to compare the recovered file with a backup copy for instance so other tools, like meld, should be able to handle them too.

Until then:
'less' and 'emacs' opens these files.
'strings' can be use to extract readable text but it doesnt appear to support utf-8.

David Stevenson wrote on the 27 Nov 09 at 00:00
Some people may not want to see the contents of non text files, but for those of us who do it is a real pain to have to find another app like ghex. It should be a configuration option only show text file / open any file.
A hex view mode should then be added as a plug-in.
This is about the only feature I miss from windows.

Pierre Chef wrote on the 27 Nov 09 at 14:35
Yeah, it's very boring when you can't open a file because there is a null inside.
Even geany doesn't want to open it.

But what's wrong with displaying a raw char ?

arkmundi wrote on the 28 Jul 10 at 13:25
My problem is openning a file and getting the "gedit has not been able to detect the character encoding" message. It is a text file that I created, but apparently introduced characters not part of the UTF-8 default encoding. Its a royal nuscience to then not be able to open it. Best fix to gedit is to open the file and have all foreign characters display uniformly as some character not normally displayed. That way I can find them and change them to a character in the encoding.

fbongor wrote on the 6 Aug 10 at 17:42
I have a large text file, with one (1!) control character in it. All editors other than gedit will show this file. Actually just to absolutely maximize my frustration, gedit does this big tease, showing me the file for about 1/5 second, then showing this huge red alert warning. It looks like the huge red firefox warning about web forgery. Surely one lone control character isn't such a huge threat!?!??? In ye olde days back in the era of text editors on text terminals, this thing was handled easily- a control character was just show as, e.g. ^K (i.e. control-K). There were representations for all 256 character combinations. Even if gedit just gave me a choice! It's nice that gedit is so fancy that it is trying to help me exotic character encoding- but why doesn't it let me say "assume character encoding XYZ" and just proceed? And one of the choices should be simple ASCII. Gosh, even Firefox lets me proceed if I want, and that could be a real threat. This gedit "feature" is extremely dysfunctional, unnecessary, frustrating, and drives me to use other editors on perfectly good simple text files. This is dumb.

kaefert wrote on the 16 Aug 10 at 18:17
I agree that is a good idea to normally prevent the opening of a binary file, because a user who doesn't know what he does can easily distroy his file. BUT the BIG BUT: Just like a browser offers you the possibility to view a https page with wrong autenthication infos (after a big red warning), just the same way gedit should let the user choose to act against what the program suggests.

mpupilli wrote on the 2 Sep 10 at 10:23
This is a flat out usability bug and is completely infuriating. I have never used a text editor which did not give you the option to open a binary file if you really wish to. There are many reasons why you would want to do so, for example; edit the ascii header of a pgm binary file (which is in ascii and intended to be human readbale/editable); or to fix a malformed xml or html file; or open custom log files which happen to use the full ascii character set but are still largely human readable.

Giving the warning is fine but you have to give the option. I would even accept the option being hidden by default and has to be enabled in settings, but there is absolutely no excuse for not giving the option.

fbongor wrote on the 3 Nov 10 at 16:49
Many people seem to misunderstand this problem, except mpupilli saying it is a usability bug. The big problem with gedit is that it does this stupid complaint when the file is not a binary file at all, but a text file, possibly with only a single perplexing character. Who knows how that got there? Who cares? What gedit needs is to have an option to open the file anyway... the "never mind" option. Instead I get this huge red warning, completely overdone, like the warning Firefox gives me when I'm about to open the website portal to the trojan horse capital of the universe. In the mean time, we've been discussing this for 2 years, and the program flatly is unusable, at its own insistence, on a wide variety of files, which it is actually capable of working with just fine, if it would just shut the (*#@*# up.

Nabla64 wrote on the 8 Feb 11 at 22:36
I thing that make like notepade ++ from windows for unreadable character is a good solution.

In notepad ++ unreadable character are marked by there hex code in black, this make that they are easly found in a text file.

orbatos wrote on the 13 Feb 11 at 04:07
gedit should always show contents of the file, even if it is ASCII only, with control codes marked in some fashion like SciTE, VIM, Notepad++, UltraEdit and many other technical editors. One the user has access to the file, options might be presented, like "Ignore", rather than forcing the user to decide what encoding to use or close the file.


Post your comment