]> saetta.ns0.it Git - solipa/libsolipa/commitdiff
Se python >= 3 allora tutte le stringhe sono unicode.
authorAndrea Zagli <azagli@libero.it>
Wed, 4 Jul 2018 16:21:21 +0000 (18:21 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 4 Jul 2018 16:21:21 +0000 (18:21 +0200)
src/ooo.c

index 0fc290ce7ad4ac38c3679c9d1074da4ff31f3f82..eadf1748cc5d0b567665d0272e2d0197d27ef984 100644 (file)
--- a/src/ooo.c
+++ b/src/ooo.c
@@ -600,6 +600,7 @@ gchar
        _search = g_strjoinv ("\\\"", g_strsplit (_search, "\"", -1));
        _replace = g_strjoinv ("\\\"", g_strsplit (_replace, "\"", -1));
 
+#if PY_MAJOR_VERSION < 3
        ret = g_strdup_printf ("%s"
                               "search.SearchString = u\"%s\"\n"
                               "found = document.findFirst(search)\n"
@@ -609,6 +610,17 @@ gchar
                               g_strcmp0 (priv->ooo_version, "") == 0 || zak_utils_compare_version (priv->ooo_version, "3.0.0", NULL, &part) > 0 ? "str" : "unicode",
                               _search,
                               _replace);
+#else
+       ret = g_strdup_printf ("%s"
+                              "search.SearchString = \"%s\"\n"
+                              "found = document.findFirst(search)\n"
+                              "found.String = %s.replace(found.String, \"%s\", \"%s\")\n",
+                              !priv->with_search ? "search = document.createSearchDescriptor()\n" : "",
+                              _search,
+                              g_strcmp0 (priv->ooo_version, "") == 0 || zak_utils_compare_version (priv->ooo_version, "3.0.0", NULL, &part) > 0 ? "str" : "unicode",
+                              _search,
+                              _replace);
+#endif
        priv->with_search = TRUE;
 
        g_free (_search);