Hi,

try this:

   cxxtools::String s1(L"André");

This "L" creates a wide character string constant.

I get then:

   [tommi@salo ~/tmp]$ g++ -o utf8_json -lcxxtools utf8_json.cpp
   [tommi@salo ~/tmp]$ ./utf8_json
   André
   {
        "text": "Andr\u00e9"
   }

Btw. I just saw, why using ostringstream? This is enough:

   #include <iostream>
   #include <cxxtools/jsonserializer.h>

   int main()
   {
         cxxtools::String s1(L"André");

         std::cout << s1 << std::endl;

         cxxtools::JsonSerializer serializer(std::cout);

         serializer.beautify(true);
         serializer.serialize(s1, "text");
         serializer.finish();
   }

Tommi
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to