<p>Now, a few words about app->confdir under *nix.</p>

<p>Geany assigns "app->confdir = alternate_config", and then in setup_config_dir() does "SETPTR(app->configdir, utils_get_locale_from_utf8(app->configdir))", freeing app->confdir, and thus alternate_config, leading to buggy reproduced option for New Window.</p>

<p>The original SM code counters this by "app->confdir = g_strdup(alternate_config)", but in my tests with a -c <em>locale_dir</em> under Linux:</p>

<ul>
<li>alternate_config was in locale (identical to <em>locale_dir</em>)</li>
<li>utils_get_locale_from_utf8(app->confdir) /from SETPTR/ failed to convert it to locale, and returned a copy of it</li>
<li>Help -> Debug Messages aborted Geany with an assertion that the text to be displayed (the 3 debug messages containing confdir, I checked that) is not valid UTF-8</li>
<li>The above points are compliant (if that's the word) with the GLib spec, which states that the G_OPTION_ARG_FILENAME options are in the GLib filename encoding, and that is locale under POSIX, not UTF-8.</li>
</ul>

<p>It seems to me then that the proper fix will be (a) not to convert app->configdir to locale, and (b) use an UTF-8 converted string for geany_debug(). I tried that, and it works on my system (bg_BG). So my questions are:</p>

<ul>
<li>Which way should I fix alternate_config being freed? Can you provide an example when converting app->configdir to locale makes sense?</li>
<li>If I'm to fix it by not converting app->confdir to locale, should I also include a fix for the Debug Messages?..</li>
</ul>

<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/653#issuecomment-139356214">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ4Uq-u71bn1OFbGxQ32Nkz2KzKBOks5owdN7gaJpZM4F7Ng5.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/653#issuecomment-139356214"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>