Reputation: 341
I'm using FLASH form embedded into html which use utf8 charset to send variables and image to php script which saves them mysql.
In flash I do use fileupload method,
var loc:*=new flash.net.URLRequest("http://url.com/code.php?s=1&name=" + vardas.text + "&email=" + email.text);
fileHandler.upload(loc);
The problem is that when I open and fill up form in INTERNET EXPLORER, i receive not UTF-8 variables in php, but if I use CHROME or FIREFOX, i get them right.
Is there a difference how IE and other browsers send data? Or do I have to somehow encode variables in action script?
Looking forward for ideas, thanks for reading.
EDIT: Possible problem - url in IE not supporting chars like č while CHROME AND FF DOES?
Upvotes: 1
Views: 661
Reputation: 6402
// fileHandler.upload(loc); // will not encode the data to utf-8
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
// add your event listeners
urlLoader.addEventListener(Event.COMPLETE, completeHandler );
urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, secErrorHandler );
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler );
var request:URLRequest = new URLRequest( "http://url.com/code.php" );
requestVars.name = vardas.text;
requestVars.email = email.text;
request.data = requestVars
//request.method = URLRequestMethod.GET;
request.method = URLRequestMethod.POST;
try {
urlLoader.load( request );
} catch (e:Error) {
trace(e);
}
[EDIT]
Here is another example that should work based on your code but prefered method would be the first example.
//You should always validate any input from the user that they can manually
// enter on both client and server side. This will help prevent a plethora
// of things including data injection and many other hacking techniques.
var url:String = 'http://url.com/code.php?s=1'
url += '&name=' + escape( vardas.text );
url += '&email=' + escape( email.text );
var loc:*=new flash.net.URLRequest(url);
fileHandler.upload(loc);
Upvotes: 1
Reputation: 90804
Do you have this header in your HTML page?
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Upvotes: 0