On 2013-03-27, Georg Baum wrote: > 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:
... >> 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. OK, as one alternative in a combo box of manual encodings, I agree. >> 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. I got your point. My idea was, of course, not to replace the manual choice of "LaTeX encoding", but a different default. Without file inclusions, the "LaTeX encoding" of the exported file does not matter for the Postscript/PDF-generation: * The encoding of the LyX-document itself is always utf8 (since several versions of LyX). * (re) import into LyX converts the from the "LaTeX encoding" into utf8. * With 8-bit LaTeX, every non-ASCII character is converted to LICRs (either by LyX (if the encoding is set to ASCII, or by the inputenc package). * With (Xe/LuaLaTeX), the LaTeX encoding is always utf8. For included files it is IMO quite sensible to assume the locale encoding as a first guess. If the "LaTeX encoding" and the locale encoding are the same, chances are best that no re-encoding is required. > Otherwise you get trouble if users edit a > german document on an english OS etc. The current default is even worse. If a user wants to edit the LaTeX-export of a German document on a system with "locale encoding" UTF-8, say, she must either: a) manually set the "LaTeX encoding" under Document>Settings>Language>... b) use an external conversion tool from latin9 to utf-8 c) use a text editor that understands several encodings and also remembers to translate the "inputenc" argument when re-encoding. b) and c) have a very important glitch: with the current default, they will (most probably)¹ break the document if it uses second language that has a different default encoding (Russian or Greek, say). ¹ There are not many editors or tools that can savely handle text documents with in-document encoding switches. This is why, the current default (language-dependent multi-encoding) is an outdated and very bad choice. It was justified to a certain degree when LyX still used 8-bit encodings for the *.lyx file itself but this is now several years ago. Considering, that UTF-8 is nowadays the default on most systems, I'd recommend to change the default. However, only after bug http://www.lyx.org/trac/ticket/8600 is fixed. Günter