GNOME Bugzilla – Bug 128458
Specify encoding from command line
Last modified: 2004-12-22 21:47:04 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.
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?
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 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
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...
or "Specify the encoding to be used for opening the files on the command line" (sorry for the spam)
committed.