peerplays-fc/src/utf8.cpp
vogel76 59f80e34d2 [BW]: [NIP] Further changes to get to work paths containing unicode characters:
- fc::path extended by method toNativeAnsiPath allowing to safely convert current unicode path into its ansi equivalent
- fc::path to_variant uses toNativeAnsiPath method instead of generic_string to avoid loss of data while serializing a path
- fc::mmap_struct_base::open should use toNativeAnsiPath method instead of generic_string to access ansi path
- fc::json::save_to_file should directly pass fc::path to underlying stream instead of generic_string.
2014-01-10 00:05:18 +01:00

28 lines
521 B
C++

#include "fc/utf8.hpp"
#include "utf8/checked.h"
#include "utf8/core.h"
#include "utf8/unchecked.h"
#include <assert.h>
namespace fc
{
void decodeUtf8(const std::string& input, std::wstring* storage)
{
assert(storage != nullptr);
utf8::utf8to32(input.begin(), input.end(), std::back_inserter(*storage));
}
void encodeUtf8(const std::wstring& input, std::string* storage)
{
assert(storage != nullptr);
utf8::utf32to8(input.begin(), input.end(), std::back_inserter(*storage));
}
} ///namespace fc