After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 128458 - Specify encoding from command line
Specify encoding from command line
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: Gedit maintainers
gedit QA volunteers
Depends on:
Blocks:
 
 
Reported: 2003-12-03 17:55 UTC by Jon Lapham
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
proposed patch (6.36 KB, patch)
2004-07-06 13:50 UTC, Paolo Borelli
needs-work Details | Review

Description Jon Lapham 2003-12-03 17:55:18 UTC
Gedit will open a file with the incorrect encoding if you change the file's
encoding (using "iconv" for example) if the file had previously been opened
using gedit.  This is because gedit caches file encoding information.

To overcome this problem, you can use the File -> Open dialog to force
gedit to use the new encoding.  

This feature request is to have the same ability available from the command
line.  Something like "--force-encoding UTF8" which would override the
gedit encoding cache when opening a file.

This is probably a fairly common issue, as people are converting files to
the UTF8 standard.

PS: it would even be nicer if gedit could automatically detect the file
encoding and use the detected encoding... but I digress.  I imagine there
are probably many problems with autodetection of file encoding.
Comment 1 Paolo Borelli 2004-07-06 13:46:38 UTC
I thought to give this a quick spin... the patch below is only lightly tested.

Jon, if you are still intersted in this, may you try it?
Comment 2 Paolo Borelli 2004-07-06 13:50:01 UTC
Created attachment 29277 [details] [review]
proposed patch

The patch adds an --encoding=charset option to specify the encoding, where
charset is something like ISO-8859-5 etc.

It merges the gedit_file_open_uri_list() and _open_uri_list_real() variants,
since one allows to specify the line and the other allows to specify the
encoding.
Comment 3 Paolo Maggi 2004-07-16 09:08:50 UTC
Comment on attachment 29277 [details] [review]
proposed patch

Tha patch looks good.
Please, commit with the following changes:

1. A better description of the option. I don't like 
+	  N_("Specify the Charset corresponding to the encoding to be used"),
NULL }
You should specify the the encoding is the one used to open the files on the
command line.
2. Update the man page.
3. ChangeLog entry
Comment 4 Paolo Borelli 2004-07-16 09:15:48 UTC
does "Specify the charset used to open the files given on the command line"
sound better?

I'll ask some native english speaker to comment...
Comment 5 Paolo Borelli 2004-07-16 09:17:59 UTC
or "Specify the encoding to be used for opening the files on the command line"


(sorry for the spam)
Comment 6 Paolo Borelli 2004-07-16 10:10:50 UTC
committed.