]> git.lyx.org Git - features.git/commitdiff
validate encodable characters in href inset (#8357)
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 28 Sep 2012 07:27:39 +0000 (09:27 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 28 Sep 2012 13:40:09 +0000 (15:40 +0200)
(cherry picked from commit 5801ee2f9a0f6536c6753567b191302960b3bf4f)

src/insets/InsetHyperlink.cpp
status.20x

index e87103ac13a757efb1a5d32a5dab69c1d6243350..c883a8260fe6e5289b475301a6e0c9da104d2347 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "Buffer.h"
 #include "DispatchResult.h"
+#include "Encoding.h"
 #include "Format.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
@@ -28,6 +29,8 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
+#include "frontends/alert.h"
+
 using namespace std;
 using namespace lyx::support;
 
@@ -185,7 +188,17 @@ void InsetHyperlink::latex(otexstream & os,
                        (pos = name.find('~', i)) != string::npos;
                        i = pos + 1)
                        name.replace(pos, 1, sim);
-
+               pair<docstring, docstring> name_latexed =
+                       runparams.encoding->latexString(name, runparams.dryrun);
+               name = name_latexed.first;
+               if (!name_latexed.second.empty()) {
+                       // issue a warning about omitted characters
+                       // FIXME: should be passed to the error dialog
+                       frontend::Alert::warning(_("Uncodable characters"),
+                               bformat(_("The following characters that are used in the href inset are not\n"
+                                         "representable in the current encoding and therefore have been omitted:\n%1$s."),
+                                       name_latexed.second));
+               }
        }  // end if (!name.empty())
        
        if (runparams.moving_arg)
index 739846f04ddacecd13e7e619a0a745dc76a2d771..b1a669cbbdfb770f184673b63cbd8b51a46c2835 100644 (file)
@@ -89,6 +89,8 @@ What's new
 - Fix bug that Elsevier documents became uncompilable when using refstyle for
   cross-references.
 
+- Fix encoding problems in hyperlink name field (bug 8357).
+
 - Fixed the layout file for scientific articles published by the American
   Psychological Association (APA) (bug 8187).