picardo
08-04-2008, 07:48 PM
Hey guys,
I wrote a simple script to make a request to the server and trace the output thus:
function sendForm(evt:MouseEvent):void {
mc_viewStack.gotoAndStop(2);
variables.senderDob = txDob.text;
variables.senderEmail = txEmail.text;
variables.senderNews = newsletterUrlVar;
variables.senderOptin = optinUrlVar;
req.data = variables;
req.method = URLRequestMethod.POST;
loader.load(req);
showBusyCursor();
loader.addEventListener(Event.COMPLETE, receiveLoad);
loader.addEventListener(IOErrorEvent.IO_ERROR, handleIoError);
}
function receiveLoad(evt:Event):void {
processXML(evt);
hideBusyCursor();
}
function handleIoError(e:IOErrorEvent):void
{
trace(e.text);
}
function processXML(e:Event):void
{
var myXML:XML = XML(e.target.data);
trace(myXML.toXMLString());
}
This is all good and fine, and it works, but the returned string is encoded in what I believe to be some sort of html entity encoding. Some of these characters are too strange to be html character entities, though. For one thing less than symbol is represented here by %3C, but it should have been <.
%3C%3Fxml%20version=%221%2E0%22%20encoding%3D%22UT F
%2D8%22%3F%3E%0A%3Cresponse%3E%0A%3Cerror%20field
%3D%220%22%3EYou%20must%20accept%20the%20official% 20rules
%3C%2Ferror%3E%0A%3Cnoprize%3E0%3C%2Fnoprize%3E%0A %3C%2Fresponse
%3E
Any help woul dbe great.
I wrote a simple script to make a request to the server and trace the output thus:
function sendForm(evt:MouseEvent):void {
mc_viewStack.gotoAndStop(2);
variables.senderDob = txDob.text;
variables.senderEmail = txEmail.text;
variables.senderNews = newsletterUrlVar;
variables.senderOptin = optinUrlVar;
req.data = variables;
req.method = URLRequestMethod.POST;
loader.load(req);
showBusyCursor();
loader.addEventListener(Event.COMPLETE, receiveLoad);
loader.addEventListener(IOErrorEvent.IO_ERROR, handleIoError);
}
function receiveLoad(evt:Event):void {
processXML(evt);
hideBusyCursor();
}
function handleIoError(e:IOErrorEvent):void
{
trace(e.text);
}
function processXML(e:Event):void
{
var myXML:XML = XML(e.target.data);
trace(myXML.toXMLString());
}
This is all good and fine, and it works, but the returned string is encoded in what I believe to be some sort of html entity encoding. Some of these characters are too strange to be html character entities, though. For one thing less than symbol is represented here by %3C, but it should have been <.
%3C%3Fxml%20version=%221%2E0%22%20encoding%3D%22UT F
%2D8%22%3F%3E%0A%3Cresponse%3E%0A%3Cerror%20field
%3D%220%22%3EYou%20must%20accept%20the%20official% 20rules
%3C%2Ferror%3E%0A%3Cnoprize%3E0%3C%2Fnoprize%3E%0A %3C%2Fresponse
%3E
Any help woul dbe great.