Skip to content

Commit

Permalink
wip: check if transliteration is available
Browse files Browse the repository at this point in the history
  • Loading branch information
carrotIndustries committed Sep 12, 2023
1 parent 7582c77 commit 6810d63
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/export_odb/odb_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@ std::ostream &operator<<(std::ostream &os, DimUm d)
return os << std::fixed << std::setprecision(3) << std::fixed << d.dim;
}

static bool check_have_transliteration()
{
auto ic = g_iconv_open("ascii//TRANSLIT", "utf-8");
const bool have_translit = ic != ((GIConv)-1);
if (!have_translit)
return false;
g_iconv_close(ic);
return true;
}

std::string utf8_to_ascii(const std::string &s)
{
return Glib::convert_with_fallback(s, "ascii//TRANSLIT", "utf-8");
static bool have_translit = check_have_transliteration();
return Glib::convert_with_fallback(s, have_translit ? "ascii//TRANSLIT" : "ascii", "utf-8");
}

std::string make_legal_name(const std::string &n)
Expand Down

0 comments on commit 6810d63

Please sign in to comment.