UTF8 support on windows for standalone json library?

Dec 31, 2015 at 5:29 PM
I like the ppl library. But I consistently bump into UTF8 cant be used with the library on windows, without doing conversions all over the place.

utility::conversions::utf8_to_utf16();

utility::conversions::utf16_to_utf8();

I need a json serialization/de-serialization for a project that doesn't use ppl (but ZeroMQ). I have used boost/property_tree/json_parser in the past but it doesn't write standard conformant json. I like the cpprest json library so I use that instead. But I have to do cumbersome (and probably expensive) conversions all over the place to be able to use UTF8.

It seems it should be very easy for you to provide a UTF8 build of the library for windows also, since as I understand it you already do a UTF8 build of the library for Linux. If not the the whole ppl, then maybe just for the json library.

Any hope of this?

Example:
#include <cpprest/json.h>

std::string SerializeToJson(std::string name, int id) //utf8 coming in and goin out
{
    utility::stringstream_t stream;
    web::json::value js_obj;
    js_obj[L"id"] = web::json::value::number(id);
    js_obj[L"name"] = web::json::value::string(utility::conversions::utf8_to_utf16(name)); //unneccessary conversion 1

    js_obj.serialize(stream);
    std::wstring wret = stream.str();
    std::string ret = utility::conversions::utf16_to_utf8(wret); //unneccessary conversion 2

    return ret;
}

int main() {

    auto r = SerializeToJson("test", 123);
    std::cout << r << std::endl;
}