HI ,
I want to pass UTF8 string as an argument to evaluateJavascript , but when i am passing the string i am getting parse error in JSconsole
frame->evaluateJavaScript(QString("socketDataReceived('% 1','%2')").arg(pi).arg(str_new));
The second qrgument str_new contains UTF string "GET /auth_ok HTTP/1.1
Host: 127.0.0.1:31415
User-Agent: Wget"
The JS function which we are calling
function socketDataReceived(type, req)
{
dbg("Notification Received:"+req);
dbg("Notification Received: of datatype"+typeof(req));
try
{
var response = "N/A";
if(req == null || req == "")
{
dbg("\033[33mUnknown request, ignoring this request\033[0m");
parent.piServerSend(response);
return;
}
var reqcommand;
var reqheaders;
var reqcmdparts;
var reqparms = [];
var reqparmparts;
var reqparams = [];
var pump;
var savedTransport;
var response;
var host;
reqheaders = req.split("\n");
if(reqheaders.length > 1)
{
reqcommand = reqheaders[0].split(' ');
}
else
{
parent.piServerSend(response);
return;
}
if(reqcommand.length > 1)
{
reqcmdparts = reqcommand[1].split('?');
}
Please help me how to pass UTF8 string as a argument in evaluateJavascript function
Thanks&Regards
Chaitu
Bookmarks