Je dispose d'un fichier XML qui fait par un script PHP:analyse syntaxique non-anglais xmls dans Android
<?xml version="1.0"?>
<posts><post><id>25</id><title>متن فارسی </title><content>s</content><summary>s</summary></post> <post><id>28</id><title>english text</title><content>1</content> <summary>1</summary></post></posts>
et je l'analyser en utilisant ce code dans Android:
public final String getElementValue(Node elem) {
Node child;
if(elem != null){
if (elem.hasChildNodes()){
for(child = elem.getFirstChild(); child != null; child = child.getNextSibling()){
if(child.getNodeType() == Node.TEXT_NODE )
return child.getNodeValue();
}
}
}
return "";
}
quand mon xml est l'anglais (par exemple post 28 dans ce xml) cela fonctionne bien
mais quand mon xml est persan (par exemple post 25 dans ce xml) il retourne seulement le premier caractère du texte.
comment puis-je gérer ce problème?
Vous avez besoin Html Décodage. voir http://stackoverflow.com/questions/2918920/decode-html-entities-in-android –