It's not only a question of selecting the correct UTF-8 encoding in the editor; this choice must be told also to LaTeX, which knows nothing about the editor program:
should be declared. For best result in all circumstances, it is recommended to use the following pattern
particularly if among the
<encodings> there is a cyrillic one (T2A, T2B or T2C). In your case only T1 is necessary:
While the Font guide seems to say that font loading packages should be loaded before fontenc (see this answer) in my experiments it does not happen that LaTeX tries to load other fonts if the pattern is, say,
Of course, if some text is typeset before loading lmodern (for instance, some length is set with
\settowidth or similar commands), then the relevant
.fd files will be loaded (and the measurement might be wrong if, instead of lmodern one loads kpfonts).
I recommend to follow this pattern (also adding other needed encodings) because in the case of languages written in the cyrillic font inputenc has to know what encodings are loaded. But this is justified also on other bases.
Let's look at the typesetting process as if it were carried on in an old typographer's shop. When a manuscript comes in, the typographer looks at it and goes to fetch the necessary cases: say T1 for the latin alphabet, T2A for the cyrillic letters and T3 for the IPA symbols. This is the fontenc step. Only after having put the cases on the working desk the typographer will start to examine the manuscript letter by letter and chose from one case or the other as told by the found letter (inputenc step). Then the letters will be put on the composition stick following the rules given by the current language (babel step).