Guenter Milde wrote: > On 2013-03-26, Scott Kostyshak wrote: >> On Tue, Mar 26, 2013 at 6:57 AM, Jean-Marc Lasgouttes >><lasgout...@lyx.org> wrote: >>> 26/03/2013 11:54, Guenter Milde: > >>>>> Can we use iconv to convert the verbatiminput file to the correct >>>>> encoding when we copy it to the temporary directory? Or would that be >>>>> too complicated for this minor issue? > >>>> The problem is that we do not know the encoding of the to-be-included >>>> file. >>>> (Of course we know it in this special case, but not generally.) > >>> Yes, it is the same problem as bibliography. > >> Why can't LyX ask for the file encoding of a given file?
It can, it is just not implemented. There is some discussion in trac for the encoding of bibtex or included files (could not find it right now, or was it on the list?). The basic idea there was to provide a combo box in the inset dialog, which offers all known encoding + an auto setting, which would guess the encoding from the contents. Then, if the encoding of the file is known (either because the user told it, or because it was guessed), LyX could convert it to the needed encoding. > Because a text file does not have an encoding specifier. With a complete > LaTeX document, one could read the argument to "inputenc", but this is > preamble codes, not present in a "to-be-included" LaTeX snippet. > > There are ways and programs to *guess* the encoding, but this is not save > and may lead to hidden errors or "random" behaviour. Yes. However, I don't see any problem with guessing, as long as it is only one alternative. In my experience the encoding guessing algorithm in vim works very well, and there are certainly others which are good as well. > This is why I propose: > > * document the issue (for all included files!) > * use the "locale encoding" for LaTeX export. What do you mean by "locale encoding"? If it means that the encoding is derived from the OS, i.e. the LANG and LC_* environment variables on linux, I strongly disagree. The output of a document should never depend on the preferred language of the user interface. It should always be completely determined by the .lyx file alone. Otherwise you get trouble if users edit a german document on an english OS etc. Georg