Ubuntu – How to know the encoding Gedit assumes for a given file

encodinggeditgnome

It appears that there are at least two questions here on Ask Ubuntu that are similar to this, but neither has been answered.

Text files can be valid under multiple encodings simultaneously. I would like to know the exact encoding gedit uses to decode a given file. Can this be done in the recent versions of gedit?

(I'd like to note that I am aware of other tools that can determine the encoding of a given file. However, I want to know the encoding as detected by gedit specifically)

Best Answer

  • As of the time of this writing, It seems that gedit does not officially expose the character encoding used to decode an open document.

    Gedit does show some encoding in the Save As dialog window. It is likely that this is the encoding that was used to decode the original file. However, without inspecting the source code of your version of gedit, there is no guarantee that the encoding shown is the actual encoding used.

    Muru has indicated (above in the comments section) that gedit exposes encoding information to plugins. I have yet to come across a plugin that adds this information to the gedit's user interface.

  • Related Question