I'm doing an app that consumes the information of a php and I have a problem with the accents and special characters. The code works perfectly but when I get the information returned from the php in json the characters and accents are returned like this \ u00a0
I would appreciate a help, Thank you very much
client.get(url, new AsyncHttpResponseHandler(){
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
if (statusCode == 200) {
ArrayList<Video> arraydatos = new ArrayList<Video>();
final Controladora controladora = new Controladora();
arraydatos = controladora.obtDatosJSON(new String(responseBody));
arraydatosVideos = new AdapterDatos(actividad, arraydatos, context);
ListView listaVideos = (ListView) findViewById(R.id.home_videos);
if (listaVideos != null){
listaVideos.setAdapter(arraydatosVideos);
ProgressBar progressBar_videos = (ProgressBar) findViewById(R.id.progressBar_home);
progressBar_videos.setVisibility(View.INVISIBLE);
}
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
}
});
public class Controladora {
//OBTENER ARREGLO DEL JSON
public ArrayList<Video> obtDatosJSON(String response){
ArrayList<Video> arraydatos = new ArrayList<Video>();
try {
JSONArray jsonArray = new JSONArray(response);
Video video;
for (int i = 0; i < jsonArray.length(); i++){
video = new Video(jsonArray.getJSONObject(i).getString("id_post"), jsonArray.getJSONObject(i).getString("nombre"), jsonArray.getJSONObject(i).getString("link_img"), jsonArray.getJSONObject(i).getString("link_video"), jsonArray.getJSONObject(i).getString("link_audio"), jsonArray.getJSONObject(i).getString("link_karaoke"), "");
arraydatos.add(video);
}
}catch (Exception e){
e.printStackTrace();
}
return arraydatos;
}
}
PHP
<?php
header("Access-Control-Allow-Origin: *");
define('WP_USE_THEMES', false);
if (file_exists("../../../../wp-blog-header.php"))
require_once("../../../../wp-blog-header.php");
wp_reset_postdata();
wp_reset_query();
$ultimos_videos = array(
'post_type' => array('videos-musicales','versiones'),
'posts_per_page' => '-1',
);
query_posts($ultimos_videos);
$videos_musicales = array();
if ( have_posts() ) : while ( have_posts() ) : the_post();
$id_video = "";
$enlace_video = "";
if(get_field('enlace_video') != ""){
$enlace_video = get_field('enlace_video');
$id_video = explode("/embed/", $enlace_video);
}
else if(get_field('enlace_de_audio') != ""){
$enlace_video = get_field('enlace_de_audio');
$id_video = explode("/embed/", $enlace_video);
}
else if(get_field('karaoke') != ""){
$enlace_video = get_field('karaoke');
$id_video = explode("/embed/", $enlace_video);
}
$resumen = get_the_excerpt();
array_push($videos_musicales, array('id_post'=>get_the_ID(), 'nombre'=>get_the_title(), 'link_img'=>'https://img.youtube.com/vi/'.$id_video[1].'/0.jpg', 'link_video'=>get_field('enlace_video'), 'link_audio'=>get_field('enlace_de_audio'), 'link_karaoke'=>get_field('karaoke'), 'resumen'=>$resumen));
endwhile; endif;
header("Content-Type: application/json",true);
echo json_encode($videos_musicales);
?>