+ os << code << breakln << "\\end{lstlisting}\n";
+ }
+
+ if (encoding_switched){
+ // Switch back
+ switchEncoding(os.os(), buffer().params(), runparams, *save_enc, true);
+ runparams.encoding = save_enc;
+ }
+
+ if (!uncodable.empty() && !runparams.silent) {
+ // issue a warning about omitted characters
+ // FIXME: should be passed to the error dialog
+ if (!multibyte_possible && !runparams.encoding->hasFixedWidth())
+ frontend::Alert::warning(_("Uncodable characters in listings inset"),
+ bformat(_("The following characters in one of the program listings are\n"
+ "not representable in the current encoding and have been omitted:\n%1$s.\n"
+ "This is due to a restriction of the listings package, which does\n"
+ "not support your encoding '%2$s'.\n"
+ "Toggling 'Use non-TeX fonts' in Document > Settings...\n"
+ "might help."),
+ uncodable, _(runparams.encoding->guiName())));
+ else
+ frontend::Alert::warning(_("Uncodable characters in listings inset"),
+ bformat(_("The following characters in one of the program listings are\n"
+ "not representable in the current encoding and have been omitted:\n%1$s."),
+ uncodable));
+ }
+}
+
+
+docstring InsetListings::xhtml(XHTMLStream & os, OutputParams const & rp) const
+{
+ odocstringstream ods;
+ XHTMLStream out(ods);
+
+ bool const isInline = params().isInline();
+ if (isInline)
+ out << html::CompTag("br");
+ else {
+ out << html::StartTag("div", "class='float-listings'");
+ docstring caption = getCaptionHTML(rp);
+ if (!caption.empty())
+ out << html::StartTag("div", "class='listings-caption'")
+ << XHTMLStream::ESCAPE_NONE
+ << caption << html::EndTag("div");