summaryrefslogtreecommitdiff
path: root/src/mbgl/util/utf.hpp
blob: 81330cfc83f8fee70d2386fa8124d99c03c2dbd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

#include <memory>

#include <locale>
#include <codecvt>

namespace mbgl {
namespace util {

class utf8_to_utf16 {
public:
    static std::u16string convert(std::string const& utf8) {
        std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
        return converter.from_bytes(utf8);
    }
};

} // namespace util
} // namespace mbgl