EDIT:
found solution myself:
cityname = encodeURIComponent(cityname);
My flash has standard text field made by "Text Tool" and loads xml file generated from that field
function load_city_xml(cityname:String = ""):void {
city_list.removeAll();
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
var urlstring:String = "http://example.com/xml_city.php?cityname="+ cityname;
trace(urlstring);
xmlLoader.load(new URLRequest(urlstring));
function LoadXML(e:Event):void {
XML.ignoreWhitespace = true;
xmlData = new XML(e.target.data);
var i:Number;
for (i=0; i < xmlData.city.length(); i++) {
city_list.addItem( {label:xmlData.city[i].namecity.text(),data:xmlData.city[i].id.text()});
}
}
}
load_city_xml();
xml has header
<?php
header("Content-type: text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
and connection to the database is also as utf8
everything seems to work fine so far, it displays utf-8 chars correctly problem exists if I do something like this:
load_city_xml(""+city_text_field.text);
it dosen't work if text tool field has special characters (like: ółśżźąćę), but works just fine for normal latin characters in textfield, it even displays data with special characters correctly.
generated link
seems to not load any xml content, but if I type it in a browser it works fine, the xml data is displayed.
can anyone tell me what I'm doing wrong? seems like php dosn't handle $_GET['cityname'] var from flash with special characters, but does from the browser