2011-02-22 13 views
15

Estoy tratando de permitir el soporte multilingüe en mi aplicación que hace una publicación HTTP para cargar nuevos mensajes. ¿Qué debo hacer para admitir el japonés & en otros idiomas no latinos? Actualmente mi código es como la siguiente:Cómo enviar caracteres Unicode en un HttpPost en Android

//note the msg string is a JSON message by the time it gets here... 
private String doHttpPost(String url, String msg) 
     throws Exception { 

    HttpPost post = new HttpPost(url); 

    StringEntity stringEntity = new StringEntity(msg); 
    post.setEntity(stringEntity); 


    return execute(post); 
} 

Respuesta

40

intente configurar la codificación de StringEntity:

StringEntity stringEntity = new StringEntity(msg, "UTF-8"); 
+0

que funcionó a la perfección, gracias Pedro. – Ben

+0

Tengo el mismo problema ¿me ayudarías en esto? – Kenji

+0

muchas gracias ... realmente me ayudó. – Jim

Cuestiones relacionadas