listings copes with variable-width encodings under platex.
if (bp.useNonTeXFonts)
return encodings.fromLyXName("utf8-plain");
+ // With platex, we don't switch encodings (not even if forced).
+ if (bp.encoding().package() == Encoding::japanese)
+ return &bp.encoding();
+
CursorSlice const & sl = innerTextSlice();
Text const & text = *sl.text();
Language const * lang =
otext.outerFont(slices_[i].pit())).language();
// Again, if we have a custom encoding, this is used
// instead of the language's.
- Encoding const * oenc = customenc
+ Encoding const * oenc = customenc
? &bp.encoding() : olang->encoding();
if (olang->encoding()->name() != "inherit")
return oenc;
docstring uncodable;
bool terminate = false;
for (size_t n = 0; n < input.size(); ++n) {
+ char_type const c = input[n];
try {
- char_type const c = input[n];
pair<docstring, bool> latex_char = latexChar(c);
docstring const latex = latex_char.first;
if (terminate && !prefixIs(latex, '\\')
result += latex;
terminate = latex_char.second;
} catch (EncodingException & /* e */) {
- LYXERR0("Uncodable character in latexString!");
+ LYXERR0("Uncodable character <" << docstring(1, c)
+ << "> in latexString!");
if (dryrun) {
result += "<" + _("LyX Warning: ")
+ _("uncodable character") + " '";
// encodings, only with fixed width encodings. Therefore we
// need to force a fixed width encoding for
// \lstlistlistingname and \lstlistingname (bug 9382).
- // This needs to be consistent with InsetListings::latex().
+ // This needs to be consistent with InsetListings::latex()
+ // rsp. InsetListings::forcedEncoding().
bool const need_fixedwidth = !use_minted &&
!runparams_.isFullUnicode() &&
+ buffer().params().encoding().package() != Encoding::japanese &&
it->second.fixedwidthpreambleencoding();
// language dependent commands (once per document)
snippets.insert(i18npreamble(it->second.langpreamble(),
// Minted can deal with all encodings.
if (buffer().params().use_minted
|| inner_enc->name() == "utf8-plain"
- || buffer().params().encoding().package() == Encoding::japanese
+ || inner_enc->package() == Encoding::japanese
|| inner_enc->hasFixedWidth())
return 0;