On 2015-06-30, Georg Baum wrote: > Guenter Milde wrote: >> On 2015-06-26, Jürgen Spitzmüller wrote: >>> 2015-06-26 16:44 GMT+02:00 Guenter Milde <mi...@users.sf.net>:
>>>> Please don't check for unencodable characters in comments. >>> It's still invalid encoding, since the output file contains invalid >>> glyphs (no matter if this line is processed by LaTeX or not). >> I have a different view on this: >> **Invalid** characters may only occure in utf-8 encoded files, >> for example in a file generated by LyX with default settings if >> * the document language defaults to utf8 >> * a second language defaults to an 8-bit encoding: ... >> \selectlanguage{ngerman}% >> \inputencoding{latin9}% >> Gr��e \selectlanguage{mongolian}% ... >> Here, the German word Grüße contains 2 invalid characters if you want to >> process/view/edit the whole file as Utf-8. > This is not invalid. Such a file is not an utf8 file, it is a file with > mixed encoding, but each single character is valid. The fact that most > editors cannot display such a file correctly is something else, but e.g. > emacs can display this file correctly. OK. However, in 8-bit encoded files, there are no *invalid* characters at all. There are characters that cannot be encoded correctly which is another problem. >> Similarily, all text parts in a comment are uncritical if the file is >> processed by TeX, because comments are not decoded at all. > This does not matter. If the user enters a comment (remember that this is > either in the preamble or in ERT) we must assume that he did that on purpose > and wants the comment to be preserved. We should not silently throw away > parts of the comment. > I agree with Jürgen here. Ignoring unencodable characters in comments means > that you don't care for the contents of the comment. This depends: * If the user wants to export the file to LaTeX, yes. * If the user wants to compile the document or export to PDF/PS/DVI, no. As LaTeX "throws away" the comment anyway, there is no need to care about missing characters. > If you don't care, then why don't you omit the characters in the first > place (or even the whole comment)? I want a concise comment in the LyX file, in order to explain what the code is about. In the document, I have the option to change the comment into a LyX-note. Fine. In the preamble, there is no way to make a "LyX-only" comment. :-( However, as the condition "preamble comment character that cannot be encoded in the chosen LaTeX encoding and has no LICR in unicodesymbols" is rare and there are workarounds (select a different encoding, use an encodable transliteration or description, or ignore the warning and proceed), I agree now that we don't need to check for "in comment" in the preamble. OTOH, the "unicodesymbols" replacements should be applied in the LaTeX-preamble, too. Currently, it seems they are applied for comments in the document, but not for the user-preamble. See http://www.lyx.org/trac/raw-attachment/ticket/9607/%C4%82%C4%83-in-preamble-comment-warning.lyx Günter