|
30 | 30 | #include <boost/date_time/posix_time/posix_time_io.hpp>
|
31 | 31 | #endif
|
32 | 32 |
|
33 |
| -#if defined(__GLIBCXX__) |
34 |
| -#include "boost/locale.hpp" |
35 |
| -#else |
36 |
| -// Not supported on libstdc++ |
| 33 | +// Could use C++ standard library if not __GLIBCXX__, |
| 34 | +// For testing purposes we just the handwritten on all platforms. |
| 35 | +#if defined(CPPREST_STDLIB_UTF_CONVERSIONS) |
37 | 36 | #include <codecvt>
|
38 | 37 | #endif
|
39 | 38 |
|
@@ -253,23 +252,24 @@ const std::error_category & __cdecl linux_category()
|
253 | 252 |
|
254 | 253 | }
|
255 | 254 |
|
256 |
| -utf16string __cdecl conversions::utf8_to_utf16(const std::string &s) |
| 255 | +utf16string __cdecl conversions::utf8_to_utf16(const std::string &src) |
257 | 256 | {
|
258 |
| -#if defined(__GLIBCXX__) |
259 |
| - return boost::locale::conv::utf_to_utf<utf16char>(s, boost::locale::conv::stop); |
260 |
| -#else |
| 257 | +#if defined(CPPREST_STDLIB_UTF_CONVERSIONS) |
261 | 258 | std::wstring_convert<std::codecvt_utf8_utf16<utf16char>, utf16char> conversion;
|
262 |
| - return conversion.from_bytes(s); |
| 259 | + return conversion.from_bytes(src); |
| 260 | +#else |
| 261 | + |
| 262 | + // TODO |
263 | 263 | #endif
|
264 | 264 | }
|
265 | 265 |
|
266 | 266 | std::string __cdecl conversions::utf16_to_utf8(const utf16string &w)
|
267 | 267 | {
|
268 |
| -#if defined(__GLIBCXX__) |
269 |
| - return boost::locale::conv::utf_to_utf<char>(w, boost::locale::conv::stop); |
270 |
| -#else |
| 268 | +#if defined(CPPREST_STDLIB_UTF_CONVERSIONS) |
271 | 269 | std::wstring_convert<std::codecvt_utf8_utf16<utf16char>, utf16char> conversion;
|
272 | 270 | return conversion.to_bytes(w);
|
| 271 | +#else |
| 272 | + // TODO |
273 | 273 | #endif
|
274 | 274 | }
|
275 | 275 |
|
|
0 commit comments