Merge branch 'master' of git.lyx.org:lyx

This commit is contained in:
Juergen Spitzmueller 2024-03-16 04:59:08 +01:00
commit 5f82a7a515

View File

@ -849,11 +849,30 @@ void PreviewLoader::Impl::dumpData(odocstream & os,
BitmapFile::const_iterator it = vec.begin(); BitmapFile::const_iterator it = vec.begin();
BitmapFile::const_iterator end = vec.end(); BitmapFile::const_iterator end = vec.end();
Encoding const & enc = buffer_.params().encoding();
for (; it != end; ++it) { for (; it != end; ++it) {
docstring res;
bool uncodable_content = false;
// check whether the content is encodable
// FIXME: the preview loader should be able
// to handle multiple encodings
// or we should generally use utf8
for (char_type n : from_utf8(it->first)) {
if (!enc.encodable(n)) {
LYXERR0("Uncodable character '"
<< docstring(1, n)
<< "' in preview snippet!");
uncodable_content = true;
} else
res += n;
}
// FIXME UNICODE // FIXME UNICODE
os << "\\begin{preview}\n" os << "\\begin{preview}\n";
<< from_utf8(it->first) // do not show incomplete preview
<< "\n\\end{preview}\n\n"; if (!uncodable_content)
os << res;
os << "\n\\end{preview}\n\n";
} }
} }