[Geany-Users] How to recognize encoding?

Richard Hardwick rch at xxxxx
Mon Oct 21 17:58:16 UTC 2013


How do I get Geany to recognize (Linux text) files
as UTF-8 encoded?

The files in question are legacy Windows txt files,
written in French (i.e. with lots of accents)
which I have converted to   mode: Unix (LF)   encoding:UTF-8
by a Perl script that does

     "iconv -f CP1252 -t UTF-8 --output=$tempfile $infile"
and
     "dos2unix -n -f $tempfile $outfile"

It appears that if the infile has a final \x{OA} character,
then this arrives in the outfile.

I can open these files with JEdit or Kate, no problem.
But Geany's behaviour with such files is inconsistent.

Sometimes Geany refuses to do anything,
saying "... does not look like a text
file, or the file encoding is not supported",

Sometimes Geany renders the file  using encoding
UTF-16 LE, which makes it look as if written in
Mandarin Chinese.

And sometimes Geany opens such 'problem' files correctly,
as UTF-8. So far as I can see, this tends to be the
case if there are already several txt files open.

I have tried putting the line /* geany_encoding=utf-8 */
as line 1 of a problem file, but that does not seem to
have any consistent effect.

The other options re encoding:
     -Using the file open dialog
     -Using the "Reload as" menu item
     -Using the "Set encoding" menu item

are not really ideal for browsing lots and lots of files.

Richard H



More information about the Users mailing list