]> git.lyx.org Git - features.git/blobdiff - src/LaTeXFeatures.cpp
After r40612, the check for isFullUnicode is redundant. So, partially
[features.git] / src / LaTeXFeatures.cpp
index 41db004897b44fd6450feee013dd46310482098d..6351b08092c3ccc255274843b816e6d76f32b9a4 100644 (file)
@@ -1155,6 +1155,15 @@ docstring const getFloatI18nPreamble(docstring const & type,
                        docstring const & name, Language const * lang,
                        Encoding const & enc, bool const polyglossia)
 {
+       // Check whether name can be encoded in the buffer encoding
+       bool encodable = true;
+       for (size_t i = 0; i < name.size(); ++i) {
+               if (enc.latexChar(name[i], true)[0] != name[i]) {
+                       encodable = false;
+                       break;
+               }
+       }
+
        docstring const language = polyglossia ? from_ascii(lang->polyglossia())
                                               : from_ascii(lang->babel());
        docstring const langenc = from_ascii(lang->encoding()->iconvName());
@@ -1162,7 +1171,7 @@ docstring const getFloatI18nPreamble(docstring const & type,
        docstring const bufenc = from_ascii(enc.iconvName());
        docstring const s1 = docstring(1, 0xF0000);
        docstring const s2 = docstring(1, 0xF0001);
-       docstring const translated = (langenc == bufenc) ? name
+       docstring const translated = encodable ? name
                : from_ascii("\\inputencoding{") + texenc + from_ascii("}")
                        + s1 + langenc + s2 + name + s1 + bufenc + s2;