[nautilus] batch-rename-utilities: fix unicode chars for replace



commit 846eba57c58f770487c44a6a4d1218d3bb2b7499
Author: Alexandru Pandelea <alexandru pandelea gmail com>
Date:   Wed Sep 7 21:48:21 2016 +0300

    batch-rename-utilities: fix unicode chars for replace
    
    In the replace mode, for some unicode characters, the displayed label
    would be incorrect.
    
    The problem is that the second argument of g_markup_escape_text is
    the number of bytes and it was used with the number of characters.
    
    Since the strings are null terminated we can just omit this parameter
    altogether and fix this as a side effect.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=770972

 src/nautilus-batch-rename-utilities.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-batch-rename-utilities.c b/src/nautilus-batch-rename-utilities.c
index 03158c0..1131dc1 100644
--- a/src/nautilus-batch-rename-utilities.c
+++ b/src/nautilus-batch-rename-utilities.c
@@ -154,7 +154,7 @@ batch_rename_replace_label_text (gchar       *label,
 
     if (substring == NULL || g_strcmp0 (substring, "") == 0)
     {
-        token = g_markup_escape_text (label, g_utf8_strlen (label, -1));
+        token = g_markup_escape_text (label, -1);
         new_label = g_string_append (new_label, token);
         g_free (token);
 
@@ -164,7 +164,7 @@ batch_rename_replace_label_text (gchar       *label,
     splitted_string = g_strsplit (label, substring, -1);
     if (splitted_string == NULL)
     {
-        token = g_markup_escape_text (label, g_utf8_strlen (label, -1));
+        token = g_markup_escape_text (label, -1);
         new_label = g_string_append (new_label, token);
         g_free (token);
 
@@ -175,14 +175,14 @@ batch_rename_replace_label_text (gchar       *label,
 
     for (i = 0; i < n_splits; i++)
     {
-        token = g_markup_escape_text (splitted_string[i], strlen (splitted_string[i]));
+        token = g_markup_escape_text (splitted_string[i], -1);
         new_label = g_string_append (new_label, token);
 
         g_free (token);
 
         if (i != n_splits - 1)
         {
-            token = g_markup_escape_text (substring, g_utf8_strlen (substring, -1));
+            token = g_markup_escape_text (substring, -1);
             g_string_append_printf (new_label,
                                     "<span background=\'#f57900\' color='white'>%s</span>",
                                     token);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]