Hi everyone
I have this App, that querys data from a php ws and a mysql db. Right now I'm having problems with special characters like ñ or accents áíó, etc.
I'm having trouble passing data to ws and back to the app because of this special chars.
DB, php and calls to WS uses charset utf-8 but still some chars shows like Canc%C3%BAn
My code in php is this
$query = "call consultaDetallePropiedad('$idprop');"; $posts = runProcedureReturnArray( $query ); /* output in necessary format */ header( 'Content-Type: text/html; charset=utf-8' ); header('Content-type: application/json'); echo json_encode(array('posts'=>$posts)); /* disconnect from the db */ @mysql_close($link);My code in titanium is this
var data = 'hash=' + SecureProperties.getString("hash"); data+= '&do=2&'; data+= 'idprop=' + propdata.idprop + '&'; data+= 'desccorta=' + propdata.desccorta + '&'; data+= 'desclarga=' + propdata.desclarga + '&'; data+= 'tipoprop=' + propdata.tipoprop + '&'; data+= 'operacion=' + propdata.operacion + '&'; data+= 'idagente=' + propdata.idusuario + '&'; data+= 'montosol=' + propdata.montosol + '&'; data+= 'periodicidad=1&'; data+= 'dispositivo=tinrobot'; var uri = 'http://test.com/ws.php?' + data; var xhr = Titanium.Network.createHTTPClient(); xhr.open('GET', uri); xhr.setRequestHeader('Content-Type', "application/json; charset=utf-8"); xhr.send();
The data returned from php is
{"posts":[{"post":{"id":"62","desccorta":"Remato Casa sm 30","desclarga":"Remato Casa 2hab y jardin","tipoprop":"Casa Habitacion","operacion":"Venta","callenumero":"Calle Tres Palos #29","colonia":"Sm 30","codigopostal":"77504","delmunicipio":"Canc%C3%BAn ","mtscuad":"0","terreno":"0","recamaras":"0","banosfull":"0","banoshalf":"0","niveles":"0","lugestac":"0","elevador":"0","aguapotable":"EXISTE","regimenprop":"","drenaje":"EXISTE","electricidad":"'EXISTE'","vialidades":"ASFALTO","telefono":"DISPONIBLE","transpub":"EXISTE","vigilancia":"PUBLICA","viasppales":"","geolat":"21.158413451829233","geolng":"-86.83859875329414","geoalt":"0","anoconstruc":"1900","propietario":"","idagente":"3","fechaalta":"0000-00-00","fechapublic":"1900-01-01","montosol":"850000","periodicidad":"1","dispositivo":"tinrobot","avaluo":"0","ultimocambio":"2014-10-30","usucambio":"128ecf542a35ac5270a87dc740918404"}}]}Field delmunicipio shows: Canc%C3%BAn and it supposed to be: Cancún
What do you would do to resolve this situation, almost indicates charset utf-8
Thanks for your help!