/* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include #include #include #include #include namespace Swift { std::string IDNA::getEncoded(const std::string& domain) { char* output; if (idna_to_ascii_8z(domain.c_str(), &output, 0) == IDNA_SUCCESS) { std::string result(output); free(output); return result; } else { return domain; } } }