<p></p>
<p><b>@codebrainz</b> commented on this pull request.</p>

<p><a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/elextr/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/elextr">@elextr</a> or anyone, can you confirm?</p><hr>

<p>In <a href="https://github.com/geany/geany/pull/2550#discussion_r456739364">src/notebook.c</a>:</p>
<pre style='color:#555'>> @@ -455,6 +455,34 @@ static void on_close_documents_right_activate(GtkMenuItem *menuitem, GeanyDocume
 }
 
 
+static void on_copy_basename_to_clipboard_activate(GtkMenuItem *menuitem, GeanyDocument *doc)
+{
+       g_return_if_fail(doc->is_valid);
+       
+       gchar *bname = g_path_get_basename(doc->real_path);
+       gtk_clipboard_set_text(gtk_clipboard_get(GDK_NONE), bname, -1);
</pre>
<p>I could be mistaken, but I think there might be a subtle encoding bug here (and the other two new functions).</p>
<p><code>doc->real_path</code> is in "locale" encoding and <code>g_path_get_basename()</code> will spit out "locale" encoding, but <code>gtk_clipboard_set_text()</code> is expecting the 2nd argument to be in UTF-8 encoding. If I'm not mistaken, it might need to be something like this (untested):</p>
<div class="highlight highlight-source-c"><pre>gchar *bname = g_path_get_basename(doc->real_path);
gchar *utf8_bname = utils_get_utf8_from_locale(bname);
<span class="pl-en">gtk_clipboard_set_text</span>(gtk_clipboard_get(GDK_NONE), utf8_bname, -1);
<span class="pl-en">g_free</span>(utf8_bname);
<span class="pl-en">g_free</span>(bname);</pre></div>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/2550#pullrequestreview-451025143">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ542C4KUX4I4OLLJ7DR4EEMXANCNFSM4O6VNGHQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAIOWJ5BQXT6N7H6CORCYZDR4EEMXA5CNFSM4O6VNGH2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODLRBR5Y.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/2550#pullrequestreview-451025143",
"url": "https://github.com/geany/geany/pull/2550#pullrequestreview-451025143",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>