I’m calling web service  to get data from db ,response I’m getting is in xml format which contains Portuguese characters also in some tags.issue I’m facing is I’m getting data in both html encoded and unencoded i.e not encoded.what I want to do to post that again to server so I’m converting special characters to its corresponding html entities and then to base64  post data.which doesn’t matched to database.what I’m suppose to do is if incoming string is encoded then also I encode when post to server and if it is not I dn’t want to encode to html entities.
Ex-incoming string is 
“ãáà çéãçêéíõôóúü€’“ <  >  <   >  '    '   "   "   '\nFrom Web App”
And I want to return it in the same format
And if incoming string is “Proc. Reg. da Republica 3º Região”
I’m suppose it to post in the same way
All the data is first saved to file and then operations performed on it.
please suggest
 
    