Welp, heres the answer I needed :) works great!!
include the following libraries:
#include <sstream>
#include <iomanip>
and pass any string you like to the function, it will encode all characters that are 'special'
static string EncodeNonASCIICharacters (std::string value)
{
ostringstream stringBuilder;
for (int i = 0; i < value.length(); i++)
{
unsigned int character = *reinterpret_cast<unsigned char *>(&(value[i]));
if (character > 127)
{
stringBuilder << "\\u";
stringBuilder << setw(4) << hex << setfill('0') << character;
} else {
string aValue;
aValue += value[i];
stringBuilder << aValue;
}
}
return stringBuilder.str();
}