Accertati di cosa realmente ti restituisce il PHP, per esempio con:
codice:
for (var i=0;i<data.length;i++) {
  alert(data.charCodeAt(i))
}