| 1 |
< |
#pragma once |
| 2 |
< |
#include <plog/Util.h> |
| 3 |
< |
|
| 4 |
< |
namespace plog |
| 5 |
< |
{ |
| 6 |
< |
class UTF8Converter |
| 7 |
< |
{ |
| 8 |
< |
public: |
| 9 |
< |
static std::string header(const util::nstring& str) |
| 10 |
< |
{ |
| 11 |
< |
const char kBOM[] = "\xEF\xBB\xBF"; |
| 12 |
< |
|
| 13 |
< |
return std::string(kBOM) + convert(str); |
| 14 |
< |
} |
| 15 |
< |
|
| 16 |
< |
#ifdef _WIN32 |
| 17 |
< |
static std::string convert(const util::nstring& str) |
| 18 |
< |
{ |
| 19 |
< |
return util::toUTF8(str); |
| 20 |
< |
} |
| 21 |
< |
#else |
| 22 |
< |
static const std::string& convert(const util::nstring& str) |
| 23 |
< |
{ |
| 24 |
< |
return str; |
| 25 |
< |
} |
| 26 |
< |
#endif |
| 27 |
< |
}; |
| 28 |
< |
} |
| 1 |
> |
#pragma once |
| 2 |
> |
#include <plog/Util.h> |
| 3 |
> |
|
| 4 |
> |
namespace plog |
| 5 |
> |
{ |
| 6 |
> |
class UTF8Converter |
| 7 |
> |
{ |
| 8 |
> |
public: |
| 9 |
> |
static std::string header(const util::nstring& str) |
| 10 |
> |
{ |
| 11 |
> |
const char kBOM[] = "\xEF\xBB\xBF"; |
| 12 |
> |
|
| 13 |
> |
return std::string(kBOM) + convert(str); |
| 14 |
> |
} |
| 15 |
> |
|
| 16 |
> |
#ifdef _WIN32 |
| 17 |
> |
static std::string convert(const util::nstring& str) |
| 18 |
> |
{ |
| 19 |
> |
return util::toUTF8(str); |
| 20 |
> |
} |
| 21 |
> |
#else |
| 22 |
> |
static const std::string& convert(const util::nstring& str) |
| 23 |
> |
{ |
| 24 |
> |
return str; |
| 25 |
> |
} |
| 26 |
> |
#endif |
| 27 |
> |
}; |
| 28 |
> |
} |