* Buffer.cpp:

- Issue a warning if a path contains uncodable characters (bug 6301).

Trunk follows.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@33512 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-02-19 14:30:56 +00:00
parent 67ab913033
commit 69c333db98
2 changed files with 40 additions and 7 deletions

View File

@ -1184,6 +1184,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"
@ -1192,6 +1222,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.

View File

@ -104,6 +104,8 @@ What's new
- Fix encoding problem in bibliography items that broke the compilation - Fix encoding problem in bibliography items that broke the compilation
of documents (bug 6534). of documents (bug 6534).
- Issue a warning if a path contains uncodable characters (bug 6301).
- Allow using single quotes in filenames (bug 4063). - Allow using single quotes in filenames (bug 4063).
- Do not insert \foreignlanguage in ERTs (bug 6426). - Do not insert \foreignlanguage in ERTs (bug 6426).