Commit d4ef0035 authored by Mahmoud Nagy's avatar Mahmoud Nagy

changing guarantee_utf8_string to convert to utf8

use g_utf8_make_valid to convert to utf8, instead of taking the most utf8 chars possible
parent 3b5c92f7
Pipeline #77657 passed with stage
in 1 minute and 32 seconds
......@@ -211,14 +211,10 @@ tracker_guarantee_resource_utf8_string (TrackerResource *resource,
const gchar *key,
const gchar *value)
{
const gchar *end;
gchar *str;
if (!g_utf8_validate (value, -1, &end)) {
if (end == value)
return FALSE;
str = g_strndup (value, end - value);
if (!g_utf8_validate (value, -1, NULL)) {
str = g_utf8_make_valid (value, -1);
tracker_resource_set_string (resource, key, str);
g_free (str);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment