After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770972 - Some text not shown on batch rename with Unicode text
Some text not shown on batch rename with Unicode text
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Internationalization (i18n)
3.21.x
Other Linux
: Normal normal
: 3.22
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-06 20:55 UTC by Mohammed Sadiq
Modified: 2016-09-08 18:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
batch-rename-utilities: fix unicode chars for replace (2.01 KB, patch)
2016-09-07 18:54 UTC, Alexandru Pandelea
none Details | Review
batch-rename-utilities: fix unicode chars for replace (2.25 KB, patch)
2016-09-08 08:41 UTC, Alexandru Pandelea
none Details | Review
batch-rename-utilities: fix unicode chars for replace (2.36 KB, patch)
2016-09-08 10:47 UTC, Alexandru Pandelea
committed Details | Review

Description Mohammed Sadiq 2016-09-06 20:55:39 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.
Comment 1 Alexandru Pandelea 2016-09-07 18:54:28 UTC
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.
Comment 2 Carlos Soriano 2016-09-08 08:15:32 UTC
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.
Comment 3 Alexandru Pandelea 2016-09-08 08:41:08 UTC
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.
Comment 4 Carlos Soriano 2016-09-08 08:48:46 UTC
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"
Comment 5 Alexandru Pandelea 2016-09-08 10:47:05 UTC
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.
Comment 6 Alexandru Pandelea 2016-09-08 18:51:53 UTC
Attachment 335083 [details] pushed as 846eba5 - batch-rename-utilities: fix unicode chars for replace