From: Andrea Zagli Date: Thu, 17 Nov 2011 14:01:59 +0000 (+0100) Subject: Aggiunta la decodifica in utf8 in SolipaOOO (fixes #213). X-Git-Tag: 0.5.0~22 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=0a8aab3ec5508db76a218486261dd6725d726440;p=solipa%2Flibsolipa Aggiunta la decodifica in utf8 in SolipaOOO (fixes #213). Aggiunto ooo.h a libsolipa.h. --- diff --git a/src/libsolipa.h b/src/libsolipa.h index 3e6c2c8..abc0d1e 100644 --- a/src/libsolipa.h +++ b/src/libsolipa.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/src/ooo.c b/src/ooo.c index 2ab5420..b9122cf 100644 --- 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)); diff --git a/tests/ooo.c b/tests/ooo.c index d069760..8074f95 100644 --- a/tests/ooo.c +++ b/tests/ooo.c @@ -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) {