#include #include #include <../common/utils.hh> #include int main() { setlocale(LC_CTYPE, ""); std::string line; std::cout << "Current locale charset is " << get_locale_charset() << std::endl; std::cout << "UTF-8 to ISO8859-15, should be ok: "; std::cout << simple_iconv("testäöÄÖ", "UTF-8", line, "ISO8859-15"); std::cout << " gives " << line << std::endl; std::cout << "Invalid UTF-8 to ISO8859-15, should fail: "; std::cout << simple_iconv(line, "UTF-8", line, "ISO8859-15"); std::cout << " gives " << line << std::endl; std::cout << "UTF-8 to locale, should be ok: "; std::cout << simple_iconv("testäöÄÖ߀£þ»”", "UTF-8", line, "", true); std::cout << " gives " << line << std::endl; while (std::getline(std::cin, line)) { if (is_valid_utf8(line)) { std::cout << "Valid UTF-8" << std::endl; } else { std::cout << "Invalid UTF-8" << std::endl; } } return 0; }