diff --git a/src/export_odb/odb_util.cpp b/src/export_odb/odb_util.cpp index 68ba884b..964cce61 100644 --- a/src/export_odb/odb_util.cpp +++ b/src/export_odb/odb_util.cpp @@ -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)