summaryrefslogtreecommitdiff
path: root/platform/default/utf.cpp
blob: fdcff344b99f368746bbc2c931f3f0bfd8e63f76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <mbgl/util/utf.hpp>

#if defined(__GNUC__) && __GNUC__ >= 7
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif // defined(__GNUC__) && __GNUC__ >= 7

#include <boost/locale/encoding_utf.hpp>

#if defined(__GNUC__) && __GNUC__ >= 7
#pragma GCC diagnostic pop
#endif // defined(__GNUC__) && __GNUC__ >= 7

namespace mbgl {
namespace util {

std::u16string convertUTF8ToUTF16(const std::string& str) {
    return boost::locale::conv::utf_to_utf<char16_t>(str);
}

std::string convertUTF16ToUTF8(const std::u16string& str) {
    return boost::locale::conv::utf_to_utf<char>(str);
}

} // namespace util
} // namespace mbgl