source: [view]
var esc = function(val){
// have to encode certain characters that indicate an object
if(typeof val=="string"){
val = val.replace(/;/g,"_sc_");
val = val.replace(/\./g,"_pr_");
val = val.replace(/\:/g,"_cl_");
//val = escape(val);
}
return val;
};
var df = dojox.embed.flashVars.serialize;
var txt = "";
if(dojo.isArray(o)){
for(var i=0;i txt += df(n+"."+i, esc(o[i]))+";";
}
return txt.replace(/;{2,}/g,";");
}else if(dojo.isObject(o)){
for(var nm in o){
txt += df(n+"."+nm, esc(o[nm]))+";";
}
return txt.replace(/;{2,}/g,";");
}
// Dev note: important that there is no double semi-colons
return n+":"+o; // String