mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
* Buffer.cpp:
- Issue a warning if a path contains uncodable characters (bug 6301). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33514 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3ec48cce2a
commit
90e28136b6
@ -1309,6 +1309,36 @@ void Buffer::writeLaTeXSource(odocstream & os,
|
|||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
// We don't know the encoding of inputpath
|
// We don't know the encoding of inputpath
|
||||||
docstring const inputpath = from_utf8(latex_path(original_path));
|
docstring const inputpath = from_utf8(latex_path(original_path));
|
||||||
|
docstring uncodable_glyphs;
|
||||||
|
for (size_t n = 0; n < inputpath.size(); ++n) {
|
||||||
|
docstring const glyph = docstring(1, inputpath[n]);
|
||||||
|
try {
|
||||||
|
if (runparams.encoding
|
||||||
|
&& runparams.encoding->latexChar(inputpath[n]) != glyph) {
|
||||||
|
LYXERR0("Uncodable character '"
|
||||||
|
<< glyph
|
||||||
|
<< "' in input path!");
|
||||||
|
uncodable_glyphs += glyph;
|
||||||
|
}
|
||||||
|
} catch (EncodingException & /* e */) {
|
||||||
|
LYXERR0("Uncodable character '"
|
||||||
|
<< glyph
|
||||||
|
<< "' in input path!");
|
||||||
|
uncodable_glyphs += glyph;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// warn user if we found uncodable glyphs.
|
||||||
|
if (!uncodable_glyphs.empty()) {
|
||||||
|
frontend::Alert::warning(_("Uncodable character in path"),
|
||||||
|
support::bformat(_("The path of your document\n"
|
||||||
|
"(%1$s)\n"
|
||||||
|
"contains glyphs that are unknown in the\n"
|
||||||
|
"current document encoding (namely %2$s).\n"
|
||||||
|
"This will likely result in incomplete output.\n\n"
|
||||||
|
"Chose an appropriate document encoding (such as utf8)\n"
|
||||||
|
"or change the path name."), inputpath, uncodable_glyphs));
|
||||||
|
} else {
|
||||||
os << "\\makeatletter\n"
|
os << "\\makeatletter\n"
|
||||||
<< "\\def\\input@path{{"
|
<< "\\def\\input@path{{"
|
||||||
<< inputpath << "/}}\n"
|
<< inputpath << "/}}\n"
|
||||||
@ -1317,6 +1347,7 @@ void Buffer::writeLaTeXSource(odocstream & os,
|
|||||||
d->texrow.newline();
|
d->texrow.newline();
|
||||||
d->texrow.newline();
|
d->texrow.newline();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// get parent macros (if this buffer has a parent) which will be
|
// get parent macros (if this buffer has a parent) which will be
|
||||||
// written at the document begin further down.
|
// written at the document begin further down.
|
||||||
|
Loading…
Reference in New Issue
Block a user