]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.cpp
Fix bug 9798.
[lyx.git] / src / support / lstrings.cpp
index be326c0fd46dea68b7b229130b488fe9f3518fd3..21fe05aa09389fb1e04b7518529d64793fe395ab 100644 (file)
@@ -164,6 +164,26 @@ bool isNumber(char_type c)
 }
 
 
+bool isEuropeanNumberSeparator(char_type c)
+{
+       if (!is_utf16(c))
+               // assume that no non-utf16 character is a numeral
+               // c outside the UCS4 range is catched as well
+               return false;
+       return ucs4_to_qchar(c).direction() == QChar::DirES;
+}
+
+
+bool isEuropeanNumberTerminator(char_type c)
+{
+       if (!is_utf16(c))
+               // assume that no non-utf16 character is a numeral
+               // c outside the UCS4 range is catched as well
+               return false;
+       return ucs4_to_qchar(c).direction() == QChar::DirET;
+}
+
+
 bool isDigitASCII(char_type c)
 {
        return '0' <= c && c <= '9';
@@ -1431,6 +1451,14 @@ std::string formatFPNumber(double x)
 }
 
 
+docstring to_percent_encoding(docstring const & in, docstring const & ex)
+{
+       QByteArray input = toqstr(in).toUtf8();
+       QByteArray excludes = toqstr(ex).toUtf8();
+       return qstring_to_ucs4(QString(input.toPercentEncoding(excludes)));
+}
+
+
 docstring bformat(docstring const & fmt, int arg1)
 {
        LATTEST(contains(fmt, from_ascii("%1$d")));