Unbreak tests

glib already runs the argument through g_locale_to_utf8 with
G_OPTION_REMAINING
This commit is contained in:
NiLuJe
2021-01-12 04:16:03 +01:00
parent 25768c6b80
commit 8f096629ec

View File

@@ -332,10 +332,17 @@ search_result Library::process_phrase(const char *loc_str, IReadLine &io, bool f
glib::Error err;
search_result rval = SEARCH_SUCCESS;
glib::CharStr str;
if (!utf8_input_)
str.reset(g_locale_to_utf8(loc_str, -1, &bytes_read, &bytes_written, get_addr(err)));
else
// Glib already runs CLI arguments through g_locale_to_utf8
if (g_get_charset(nullptr)) {
// Current locale is UTF-8
str.reset(g_strdup(loc_str));
} else {
if (!utf8_input_) {
str.reset(g_strdup(loc_str));
} else {
str.reset(g_locale_from_utf8(loc_str, -1, &bytes_read, &bytes_written, get_addr(err)));
}
}
if (nullptr == get_impl(str)) {
fprintf(stderr, _("Can not convert %s to utf8.\n"), loc_str);