re-adding u32string if ASCII instead of use only Boost.Locale

This commit is contained in:
Cristian Ritter
2025-06-12 12:52:13 -03:00
committed by Thomas Krijnen
parent 3503d41b3f
commit d10c176bb6
+10
View File
@@ -422,5 +422,15 @@ std::string IfcUtil::convert_utf8(const std::u32string& string) {
}
std::u32string IfcUtil::convert_utf8(const std::string& s) {
bool is_ascii = true;
for (char c : s) {
if (static_cast<unsigned char>(c) >= 128) {
is_ascii = false;
break;
}
}
if (is_ascii) {
return std::u32string(s.begin(), s.end());
}
return boost::locale::conv::utf_to_utf<char32_t>(s);
}