From: Andrea Zagli Date: Wed, 4 Jul 2018 16:21:21 +0000 (+0200) Subject: Se python >= 3 allora tutte le stringhe sono unicode. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=2b6c3503de8a670ff28d1adc75caa6d354425a51;p=solipa%2Flibsolipa Se python >= 3 allora tutte le stringhe sono unicode. --- diff --git a/src/ooo.c b/src/ooo.c index 0fc290c..eadf174 100644 --- 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);