Utilities: Use inconv with MSVC

This commit is contained in:
Jonas Kvinge 2022-04-15 17:44:04 +02:00
parent d587d24603
commit 907dfee6f7
2 changed files with 4 additions and 18 deletions

View File

@ -786,23 +786,11 @@ QString DesktopEnvironment() {
}
QString UnicodeToAscii(QString unicode) {
QString UnicodeToAscii(const QString &unicode) {
#ifdef _MSC_VER
return unicode
.replace(QChar(229), "a")
.replace(QChar(197), 'A')
.replace(QChar(230), "ae")
.replace(QChar(198), "AE")
.replace(QChar(248), 'o')
.replace(QChar(216), 'O');
#else
# ifdef LC_ALL
#ifdef LC_ALL
setlocale(LC_ALL, "");
# endif
#endif
iconv_t conv = iconv_open("ASCII//TRANSLIT", "UTF-8");
if (conv == reinterpret_cast<iconv_t>(-1)) return unicode;
@ -829,8 +817,6 @@ QString UnicodeToAscii(QString unicode) {
delete[] output_ptr;
return ret;
#endif // _MSC_VER
}
QString MacAddress() {

View File

@ -132,7 +132,7 @@ QString GetRandomString(const int len, const QString &UseCharacters);
QString DesktopEnvironment();
QString UnicodeToAscii(QString unicode);
QString UnicodeToAscii(const QString &unicode);
QString MacAddress();