I use Lyx to edit document whose class declares \usepackage[latin2]{inputenc} in its .cls file. While I only use languages for which Lyx uses the same encoding it only adds the same command (\usepackage[latin2]{inputenc}) to preamble of the document. However when I started to use some more languages the command that is added by Lyx to preamble is changed to something like \usepackage[latin9, latin2]{inputenc}. Then I get following error:
LaTeX Error: Option clash for package inputenc.
\setcounter
{secnumdepth}{3}
The package inputenc has already been loaded with options:
[latin2]
There has now been an attempt to load it with options
[latin9,latin2]
Lyx does not seem to expect that classes may use inputenc themselves. What is the right solution to this problem? Should I prevent Lyx from adding any inputenc to preamble? Is there some LaTeX command that can override \usepackage? Or is this problem of the class I'm using so I should modify it? Perhaps I should delete that \usepackage[latin2]{inputenc} from that class or replace it by something...
Edit
Important note: I'm not really asking for some quick dirty fix (I could figure out some myself). I'm trying to make that class work with Lyx also for other users (writing Lyx layout file for it etc.). So I want to do this the right way. If the problem is poor design of LaTeX class I should fix that one. If it is poor Lyx design I should try to submit bug report or fix it myself.
inputencpackage has already been loaded by the class and use what @Harish Kumar suggested automatically... – drasto Dec 25 '12 at 22:31\documentclass{....}. Why does that class uselatin2encoding instead of something likeutf8xanyway? Well, why does it useinputencat all? Other classes do not seem to use anything like\usepackage[whatever]{inputenc}. – drasto Dec 25 '12 at 22:37\documentclass{....}unless I'm missing something. Please also see my edit to the original question. – drasto Dec 25 '12 at 22:44