I came across a problem I am not sure how to solve. Here is my code.
#include "rapidjson/write.h"
#include "rapidjson/stringbuffer.h"
...
void WriteResultToJSON()
{
CHAR a[] = "a";
TCHAR b[] = _T("b");
WCHAR c[] = L"c";
StringBuffer s;
Writer<StringBuffer> writer(s);
writer.StartObject();
writer.String("A:");
writer.String(a);
writer.String("B");
writer.String(b);
writer.String("C");
writer.String(c);
write.EndObject();
printf(s.GetString());
}
When the project character set value is "Use Unicode Character Set", I am not able to compile. Only when it is set to "Use Multi-Byte Character Set".
Error says:
no instance of overloaded function "rapidjson::Writter<OutputStream, SourceEncoding, Target Encoding, StackAllocator>::String [with OutputStream=rapidjson::StringBuffer, SourceEncoding=rapidjson::UTF8<char>,TargetEncoding=rapidjson::UTF8<char>, StackAllocator=rapidjson::CtrAllocator]" matches the argument list
argument types are (TCHAR [2])
object type is: rapidjson::Writter<rapidjson::StringBuffer, rapidjson::UTF8<char>, rapidjson::UTF8<char>, rapidjson::CrtAllocator>
I got a bad feeling that rapidjson supports only utf8 and it wont work with my current project which is all in utf16, or is there a way how to use it when character set is set to unicode?
Thank you
yary