2

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

jignesh Vadadoriya
  • 3,244
  • 3
  • 18
  • 29
Nitisha Sharma
  • 239
  • 4
  • 14
  • 1
    Possible duplicate of [How do I decode HTML entities in swift?](http://stackoverflow.com/questions/25607247/how-do-i-decode-html-entities-in-swift) – Martin R Nov 28 '16 at 12:01
  • @Martin- please read my question again. – Nitisha Sharma Nov 28 '16 at 12:13
  • Well, you cannot decide if `&` for sure is meant verbatim or as a HTML entity. You could only use heuristics and check if the string contains one (or more) HTML entities. Some code in the linked-to Q&A might help with that. – Martin R Nov 28 '16 at 12:17
  • @MartinR- please check the link [https://gist.github.com/nitisha1/831ca45ffbf9ad7ef7591554d504f199].i've described what i'm facing issue. – Nitisha Sharma Nov 29 '16 at 08:02

0 Answers0