From cd98de4129efdccec2ce1e2cb077ea06d9251608 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnter=20Milde?= Date: Thu, 9 May 2019 09:28:37 +0200 Subject: [PATCH] Improve error message and ctests for input encoding cp858. Encoding cp858 supported by only some iconv variants. Most users will want to change their "encoding" setting instead of installing/recompiling "iconv" to support this legacy encoding. ctests are likely will fail with either "vanilla" or "enhanced" iconv and test a situation that is unlikely to change generally, so we ignore this test now by default. --- autotests/export/latex/cp858.lyx | 80 ----- autotests/export/latex/inputenc-cp858.lyx | 364 ++++++++++++++++++++++ development/autotests/ignoredTests | 5 + development/autotests/invertedTests | 7 - development/autotests/unreliableTests | 2 +- src/Buffer.cpp | 8 +- 6 files changed, 375 insertions(+), 91 deletions(-) delete mode 100644 autotests/export/latex/cp858.lyx create mode 100644 autotests/export/latex/inputenc-cp858.lyx diff --git a/autotests/export/latex/cp858.lyx b/autotests/export/latex/cp858.lyx deleted file mode 100644 index 5884f3c9f8..0000000000 --- a/autotests/export/latex/cp858.lyx +++ /dev/null @@ -1,80 +0,0 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 515 -\begin_document -\begin_header -\save_transient_properties true -\origin unavailable -\textclass article -\use_default_options true -\maintain_unincluded_children false -\language english -\language_package default -\inputencoding cp858 -\fontencoding global -\font_roman "default" "default" -\font_sans "default" "default" -\font_typewriter "default" "default" -\font_math "auto" "auto" -\font_default_family default -\use_non_tex_fonts false -\font_sc false -\font_osf false -\font_sf_scale 100 100 -\font_tt_scale 100 100 -\use_microtype false -\graphics default -\default_output_format pdf2 -\output_sync 0 -\bibtex_command default -\index_command default -\paperfontsize default -\spacing single -\use_hyperref false -\papersize default -\use_geometry false -\use_package amsmath 1 -\use_package amssymb 1 -\use_package cancel 1 -\use_package esint 1 -\use_package mathdots 1 -\use_package mathtools 1 -\use_package mhchem 1 -\use_package stackrel 1 -\use_package stmaryrd 1 -\use_package undertilde 1 -\cite_engine basic -\cite_engine_type default -\biblio_style plain -\use_bibtopic false -\use_indices false -\paperorientation portrait -\suppress_date false -\justification true -\use_refstyle 1 -\index Index -\shortcut idx -\color #008000 -\end_index -\secnumdepth 3 -\tocdepth 3 -\paragraph_separation indent -\paragraph_indentation default -\quotes_language english -\papercolumns 1 -\papersides 1 -\paperpagestyle default -\tracking_changes false -\output_changes false -\html_math_output 0 -\html_css_as_file 0 -\html_be_strict false -\end_header - -\begin_body - -\begin_layout Standard -Test. -\end_layout - -\end_body -\end_document diff --git a/autotests/export/latex/inputenc-cp858.lyx b/autotests/export/latex/inputenc-cp858.lyx new file mode 100644 index 0000000000..2cd2a3c7d7 --- /dev/null +++ b/autotests/export/latex/inputenc-cp858.lyx @@ -0,0 +1,364 @@ +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 573 +\begin_document +\begin_header +\save_transient_properties true +\origin unavailable +\textclass article +\use_default_options true +\maintain_unincluded_children false +\language english +\language_package default +\inputencoding cp858 +\fontencoding auto +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" +\font_default_family default +\use_non_tex_fonts false +\font_sc false +\font_osf false +\font_sf_scale 100 100 +\font_tt_scale 100 100 +\use_microtype false +\use_dash_ligatures true +\graphics default +\default_output_format pdf2 +\output_sync 0 +\bibtex_command default +\index_command default +\paperfontsize default +\spacing single +\use_hyperref false +\papersize default +\use_geometry false +\use_package amsmath 1 +\use_package amssymb 1 +\use_package cancel 1 +\use_package esint 1 +\use_package mathdots 1 +\use_package mathtools 1 +\use_package mhchem 1 +\use_package stackrel 1 +\use_package stmaryrd 1 +\use_package undertilde 1 +\cite_engine basic +\cite_engine_type default +\biblio_style plain +\use_bibtopic false +\use_indices false +\paperorientation portrait +\suppress_date false +\justification true +\use_refstyle 1 +\use_minted 0 +\index Index +\shortcut idx +\color #008000 +\end_index +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\paragraph_indentation default +\is_math_indent 0 +\math_numbering_side default +\quotes_style english +\dynamic_quotes 0 +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tablestyle default +\tracking_changes false +\output_changes false +\html_math_output 0 +\html_css_as_file 0 +\html_be_strict false +\end_header + +\begin_body + +\begin_layout Standard +The legacy encoding +\begin_inset Quotes eld +\end_inset + +cp858 +\begin_inset Quotes erd +\end_inset + + supported by the +\emph on +inputenc +\emph default + package but not all +\emph on +iconv +\emph default + variants. +\end_layout + +\begin_layout Standard +(Gnu iconv only supports it, if configured with "--enable-extra-encodings", + see https://www.gnu.org/software/libiconv/). +\end_layout + +\begin_layout Standard +We therefore do not test it separately (and ignore this test by default). +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/001-4-latin.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/005-7-ipa-modifiers-combining.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/008-greek-and-coptic.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/009-cyrillic.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/009-cyrillic_ru.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/012-hebrew_he.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/012-hebrew_he_HE8.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/031-thai_th.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/065-67-phonetic-extensions.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/068-latin-extended-additional.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/069-greek-extended.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/070-72-general-punctuation-sub-super-currency.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/074-76-letterlike-numberforms-arrows.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/077-mathops.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/078-79-misc-technical-control-pics.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/081-enclosed-alphanumerics.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/082-84-box-drawing-blocks-geometric.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/084-misc-symbols.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/085-dingbats.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/087-90-misc-math-A-arrows-A-B.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/091-92-misc-math-B-supp-math-ops.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/125_152-modifiers-presentation.lyx" +literal "false" + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset CommandInset include +LatexCommand input +filename "unicodesymbols/246-mathematical-alphanumeric.lyx" +literal "false" + +\end_inset + + +\end_layout + +\end_body +\end_document diff --git a/development/autotests/ignoredTests b/development/autotests/ignoredTests index ec809262c9..7a0b0a709a 100644 --- a/development/autotests/ignoredTests +++ b/development/autotests/ignoredTests @@ -25,6 +25,11 @@ export/examples/Modules/Noweb2LyX_lyx16 # due to following xhtml export of converted file export/doc/(ja/|)MergedManuals_(xhtml|lyx2[2-9]) +# Legacy encoding cp858 only supported by some iconv variants. +# (Gnu iconv only supports it, if configured with "--enable-extra-encodings" +# see https://www.gnu.org/software/libiconv/) +export/export/latex/inputenc-cp858_pdf2 + # =========================================== Sublabel: special diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests index de146637f3..f3b3581ad2 100644 --- a/development/autotests/invertedTests +++ b/development/autotests/invertedTests @@ -23,13 +23,6 @@ export/doc/(|de/|es/|fr/)EmbeddedObjects_pdf4_systemF # iconv fails, if a nomenclature inset contains an uncodable character export/export/latex/iconv-error-nomenclature_pdf2 -# Encoding cp858 only supported by some iconv variants. -# (Gnu iconv only supports it, if configured with "--enable-extra-encodings" -# see https://www.gnu.org/software/libiconv/) -# Configure should test for support before offering this encoding -# in the "Document>Settings>Language>Encoding>Other" combo-box. -export/export/latex/cp858_pdf2 - # `acmart` document class: # (see also lyxbugs below and ignoredTests) # issues with listsof, reported to the maintainer diff --git a/development/autotests/unreliableTests b/development/autotests/unreliableTests index 71e2ac3028..ef9e960ab4 100644 --- a/development/autotests/unreliableTests +++ b/development/autotests/unreliableTests @@ -129,7 +129,7 @@ Sublabel: varying_versions # Encoding cp858 only supported by some iconv variants # Gnu iconv only supports it, if configured with "--enable-extra-encodings" # (see https://www.gnu.org/software/libiconv/) -export/export/latex/cp858_pdf2 +export/export/latex/inputenc-cp858_pdf2 # Seminar export with LaTeX fails in latest TeXLive: export/examples/(|fr/)seminar_(dvi|pdf).* diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 6f53a567db..cb08e3c4fb 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -1726,9 +1726,11 @@ Buffer::ExportStatus Buffer::makeLaTeXFile(FileName const & fname, try { ofs.reset(encoding); } catch (iconv_codecvt_facet_exception const & e) { lyxerr << "Caught iconv exception: " << e.what() << endl; - Alert::error(_("Iconv software exception Detected"), bformat(_("Please " - "verify that the support software for your encoding (%1$s) is " - "properly installed"), from_ascii(encoding))); + Alert::error(_("Iconv software exception Detected"), + bformat(_("Please verify that the 'iconv' support software is" + " properly installed and supports the selected encoding" + " (%1$s), or change the encoding in" + " Document>Settings>Language."), from_ascii(encoding))); return ExportError; } if (!openFileWrite(ofs, fname)) -- 2.39.5