summaryrefslogtreecommitdiff
path: root/platform/default/utf.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-07-11 17:42:50 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-07-12 20:42:29 +0300
commitd918f8d7c2e9eb4e3514078da6621c159e67069c (patch)
treefdc1a2f1440201d1d8f9ca29a44e6fc2636297ed /platform/default/utf.cpp
parent3afbfa2de74d26f1d9099a85cc1b6ed70251666f (diff)
downloadqtlocation-mapboxgl-d918f8d7c2e9eb4e3514078da6621c159e67069c.tar.gz
[core] GCC 4.9 does not provide <codecvt>
Diffstat (limited to 'platform/default/utf.cpp')
-rw-r--r--platform/default/utf.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/platform/default/utf.cpp b/platform/default/utf.cpp
index ba9678c91f..8fc44a9ed3 100644
--- a/platform/default/utf.cpp
+++ b/platform/default/utf.cpp
@@ -2,14 +2,24 @@
#include <memory>
#include <locale>
+
+// GCC 4.9 compatibility
+#if !defined(__GNUC__) || __GNUC__ >= 5
#include <codecvt>
+#else
+#include <boost/locale/encoding_utf.hpp>
+#endif
namespace mbgl {
namespace util {
std::u16string utf8_to_utf16::convert(std::string const& utf8) {
+#if !defined(__GNUC__) || __GNUC__ >= 5
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
return converter.from_bytes(utf8);
+#else
+ return boost::locale::conv::utf_to_utf<char16_t>(utf8.c_str(), utf8.c_str() + utf8.size());
+#endif
}
} // namespace util