Comment 6 for bug 178173

Revision history for this message
Norbert Preining (preining) wrote : Re: [Bug 178173] Re: Font problems with .tex files and special (danish) characters

Hi Christian,

On So, 23 Dez 2007, Christian Dalbjerg wrote:
> 1. Open the files with kile; kile shows Ã?? instead of 'æ', Ã?? instead of 'ø' and Ã¥ instead of 'å'. I can compile the files and get the correct output, but the .tex file is messed up with strange symbols. This is of course not acceptable, as I work with these files on a daily basis.

Ok, I installed kile and see what is going on. Your ENVIRONMENT is not
set up for UTF8 but for some national encoding, if you enter
 locale
on the cmd line of a shell you will see something like
 LANG=xx.YYYYY
where the YYYYY is the encoding. Maybe you have as YYYYY
 ISO-8859-15
which is ok.

BUT: Your tex files are encoded in utf8. Kile seems to have the problem
that it cannot autodetect the encoding of files automatically.

Now kile opens your file as ISO-8859-15 encoding so that there appear
that strange double letters (because 'æ' is encoded as 2 bytes in utf8).

> 2. Open the .tex file with gedit, and copy the code into kile. Now the letters display correctly in the editor, but I can't compile the files: I am getting errors like the ones posted in the original report.

gedit CAN auto-detect that encoding so opens your tex files in utf8 and
shows you the right characters. Now when you copy from gedit to kile you
enter a 'æ' in national encoding into the kile file. Now if you save
that and compile it with latex it breaks because you have
 \usepackage[utf8]{inputenc}
and the 'æ' in your local encoding is NOT utf8!!

So all this is to be expected, but the problem that kile is too stupid
to autodetect encodings. Maybe this could be filed as a bug report
against kile.

You have the following options, depending on HOW you want to save your
files:

1) you want to use utf8 as default encoding for your tex files

  tell kile that files should always be treated as utf8:
  Settings -> Configure Kile
     Editor -> Open/Save
       change "Encoding" to "Unicode ( utf8 )"

   from now on all files opened in kile will be treated as utf8
   inputenc. So don't forget theusepackage line as above.

2) you switch to iso-8859-15 as default encoding for your tex files

   leave kile alone
   leave gedit alone
   edit your tex files to include
     \usepackage[latin9]{inputenc} % or latin1
   You should recode your tex files to latin9 with
     recode utf8..recode file.tex
   so that your 'æ' gets translated from utf8 to latin1/9.

I hope that all this is a bit clearer now.

Ah yes, why you did have problems on other computers: You copied the 'æ'
from gedit into kile. kile saved it in your national encoding, but the
tex file specifies inputencoding utf8, thus it breaks on other systems,
too.

So to sum it up: The real bug is with kile which cannot autodetect the
encoding of files.

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <email address hidden> Vienna University of Technology
Debian Developer <email address hidden> Debian TeX Group
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
FORD Six pints of bitter. And quickly please, the
 world's about to end.
BARMAN Oh yes, sir? Nice weather for it.
                 --- Douglas Adams, The Hitchhikers Guide to the Galaxy