diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-10-18 17:33:27 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-10-23 12:23:40 +0200 |
commit | 282c71e8e9a8ec9c2eab612f2e60a71b15d24c8a (patch) | |
tree | 2d5a7d0f9b054af2686fe94dfa8c5690e8c92e72 /platform/default/utf.cpp | |
parent | 729eeeb3f821981cc5d3c9e06ffbb85ed4d857d7 (diff) | |
download | qtlocation-mapboxgl-282c71e8e9a8ec9c2eab612f2e60a71b15d24c8a.tar.gz |
[core] unify UTF-8/16 conversion to <boost/locale/encoding_utf.hpp>
Diffstat (limited to 'platform/default/utf.cpp')
-rw-r--r-- | platform/default/utf.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/platform/default/utf.cpp b/platform/default/utf.cpp index 8bc8ea7314..f0f9d3e67a 100644 --- a/platform/default/utf.cpp +++ b/platform/default/utf.cpp @@ -1,13 +1,16 @@ #include <mbgl/util/utf.hpp> -#include <locale> -#include <codecvt> +#include <boost/locale/encoding_utf.hpp> namespace mbgl { namespace util { -std::u16string utf8_to_utf16::convert(const std::string& utf8) { - return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>().from_bytes(utf8); +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 |