summaryrefslogtreecommitdiff
path: root/src/addressbook/libedata-book
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2018-07-03 14:16:08 +0200
committerMilan Crha <mcrha@redhat.com>2018-07-03 14:16:08 +0200
commit20a03b5d1695a05915c5ae1c7112707fac8ad464 (patch)
tree18023e6a2d257036582535e198e7de44b584a3ad /src/addressbook/libedata-book
parenteaf1b9f32392f8ed90204c00293f282c88ba0281 (diff)
downloadevolution-data-server-20a03b5d1695a05915c5ae1c7112707fac8ad464.tar.gz
Make sure errors reported from backends are valid UTF-8 strings
At least the EBookCache can store non-UTF-8 values into the database within the INSERT statement, which require conversion to UTF-8, otherwise an "[Invalid UTF-8]" error is shown on the client side instead.
Diffstat (limited to 'src/addressbook/libedata-book')
-rw-r--r--src/addressbook/libedata-book/e-data-book.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/addressbook/libedata-book/e-data-book.c b/src/addressbook/libedata-book/e-data-book.c
index f851a3891..a99ef4d3c 100644
--- a/src/addressbook/libedata-book/e-data-book.c
+++ b/src/addressbook/libedata-book/e-data-book.c
@@ -1789,10 +1789,16 @@ void
e_data_book_report_error (EDataBook *book,
const gchar *message)
{
+ gchar *valid_utf8;
+
g_return_if_fail (E_IS_DATA_BOOK (book));
g_return_if_fail (message != NULL);
- e_dbus_address_book_emit_error (book->priv->dbus_interface, message);
+ valid_utf8 = e_util_utf8_make_valid (message);
+
+ e_dbus_address_book_emit_error (book->priv->dbus_interface, valid_utf8 ? valid_utf8 : message);
+
+ g_free (valid_utf8);
}
/**