<p>In <a href="https://github.com/geany/geany/pull/637#discussion_r38643575">src/utils.c</a>:</p>
<pre style='color:#555'>> +                            gboolean val = *(gboolean *)optentry->arg_data;
> +                          gboolean reverse = (optentry->flags & G_OPTION_FLAG_REVERSE);
> +                          if ((val && !reverse) || (!val && reverse)) /* logical XOR */
> +                                  s = g_strdup_printf("--%s", optentry->long_name);
> +                  }
> +                  break;
> +
> +          case G_OPTION_ARG_INT:
> +                  if (*(gint *)optentry->arg_data)
> +                          s = g_strdup_printf("--%s=%d", optentry->long_name, *(gint *)optentry->arg_data);
> +                  break;
> +
> +          case G_OPTION_ARG_STRING:
> +          case G_OPTION_ARG_FILENAME:
> +                  if (*(gchar **)optentry->arg_data)
> +                          s = g_strdup_printf("--%s=%s", optentry->long_name, *(gchar **)optentry->arg_data);
</pre>
<p><code>STRING</code> and <code>FILENAME</code> have different encoding, I'm not sure if a conversion is needed.</p>

<p><a href="https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#glib-Commandline-option-parser.description">GLib's docs</a> say:</p>

<blockquote>
<p>On UNIX systems, the argv that is passed to <code>main()</code> has no particular encoding, even to the extent that different parts of it may have different encodings. In general, normal arguments and flags will be in the current locale and filenames should be considered to be opaque byte strings. Proper use of <a href="https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#G-OPTION-ARG-FILENAME:CAPS">G_OPTION_ARG_FILENAME</a> vs <a href="https://developer.gnome.org/glib/unstable/glib-Commandline-option-parser.html#G-OPTION-ARG-STRING:CAPS">G_OPTION_ARG_STRING</a> is therefore important.</p>
</blockquote>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/geany/geany/pull/637/files#r38643575">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJxruQ2vFvWqH-CcZrR9T_RceMfcnks5ouD9pgaJpZM4F1KFb.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/pull/637/files#r38643575"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>