]> saetta.ns0.it Git - solipa/libsolipa/commitdiff
Aggiunta la decodifica in utf8 in SolipaOOO (fixes #213).
authorAndrea Zagli <azagli@libero.it>
Thu, 17 Nov 2011 14:01:59 +0000 (15:01 +0100)
committerAndrea Zagli <azagli@libero.it>
Thu, 17 Nov 2011 14:01:59 +0000 (15:01 +0100)
Aggiunto ooo.h a libsolipa.h.

src/libsolipa.h
src/ooo.c
tests/ooo.c

index 3e6c2c83f59a58716b8747c5c5c40f74c52e952b..abc0d1ebc2f93cdf0c1f530ffb6b038a8619f65c 100644 (file)
@@ -22,6 +22,7 @@
 #include <libsolipa/solipa.h>
 #include <libsolipa/allegato.h>
 #include <libsolipa/mail.h>
+#include <libsolipa/ooo.h>
 #include <libsolipa/progresswindow.h>
 #include <libsolipa/utils.h>
 
index 2ab54204dfc31ede0987cd1dd7b0ec15e9cb8942..b9122cf34c1133f62d7097b7acd76c0ac33f918d 100644 (file)
--- a/src/ooo.c
+++ b/src/ooo.c
@@ -202,7 +202,7 @@ solipa_ooo_string_replace (SolipaOOO *ooo, const gchar *search, const gchar *rep
        PyRun_SimpleString (g_strdup_printf (
                            "search.SearchString = u\"%s\"\n"
                            "found = document.findFirst(search)\n"
-                           "found.String = string.replace(found.String, u\"%s\", u\"%s\")\n",
+                           "found.String = string.replace(found.String, u\"%s\", \"%s\".decode(\"utf-8\"))\n",
                            _search,
                            _search,
                            _replace));
@@ -307,6 +307,8 @@ solipa_ooo_apri_openoffice (SolipaOOO *ooo)
        priv->m_main = PyImport_AddModule ("__main__");
        priv->dict = PyModule_GetDict (priv->m_main);
 
+       PyRun_SimpleString ("# coding: utf-8\n");
+
 #ifdef G_OS_WIN32
 
        ooo_path = g_strjoinv ("\\\\", g_strsplit (priv->ooo_path, "\\", -1));
index d069760792511857f9550719f2568429d7bdb230..8074f95636d22cd8137a8a33c8d351f653ccd5cf 100644 (file)
@@ -55,7 +55,7 @@ main (int argc, char *argv[])
 
        solipa_ooo_apri_documento (ooo, argv[1]);
 
-       solipa_ooo_string_replace (ooo, "{prg::replace}", "\"blah blah blah\"");
+       solipa_ooo_string_replace (ooo, "{prg::replace}", "\"blah blah blah ààà ììì òòò ÈÈÈ ÀÀÀ ÙÙÙ\"");
 
        if (argc >= 3)
                {