GNOME Bugzilla – Bug 770972
Some text not shown on batch rename with Unicode text
Last modified: 2016-09-08 18:51:58 UTC
How to reproduce: 1. Create some files with some unicode names: eg: ഗ്നു.txt നല്ലത്.txt 2. Select the files and rename 3. Click "Find and replace text" The text gets rendered incorrectly. This glitch has been tested with Arabic, Malayalam and Russian Texts. When some matching replacement text is given, further inconsistencies can be seen.
Created attachment 335018 [details] [review] batch-rename-utilities: fix unicode chars for replace In the replace mode, for some unicode characters, the displayed label would be incorrect. The problem was that the second argument of g_markup_escape_text is the number of bytes and it was used with the number of characters.
Review of attachment 335018 [details] [review]: Ugh! I didn't think about that :) Good catch! In the commit message use the present tense. "The problem IS" not "The problem WAS". I believe you are missing one at line 178 ::: src/nautilus-batch-rename-utilities.c @@ +155,3 @@ if (substring == NULL || g_strcmp0 (substring, "") == 0) { + token = g_markup_escape_text (label, strlen (label)); you can use -1, we assume the strings are null terminated. Same for all of them.
Created attachment 335073 [details] [review] 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.
Review of attachment 335073 [details] [review]: Sorry I missed to say something more. In the commit message explain what we do to fix it. So in this case something like (feel free to push after modifying this): "Since the strings are null terminated we can just omit this parameter altogether and fix this as a side effect"
Created attachment 335083 [details] [review] 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.
Attachment 335083 [details] pushed as 846eba5 - batch-rename-utilities: fix unicode chars for replace