how to check whether response string has html encoded entities or not in swift 3.0
<p>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 <code>html</code> 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 <code>html</code> entities and then to <code>base64</code>  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 <code>html</code> entities.
Ex-incoming string is </p>

<pre><code>“&amp;amp;amp;#227;&amp;amp;amp;#225;&amp;amp;amp;#224;&amp;amp;amp;#226;€€&amp;amp;amp;#231;&amp;amp;amp;#233;&amp;amp;amp;#227;&amp;amp;amp;#231;&amp;amp;amp;#234;&amp;amp;amp;#233;&amp;amp;amp;#237;&amp;amp;amp;#245;&amp;amp;amp;#244;&amp;amp;amp;#243;&amp;amp;amp;#250;&amp;amp;amp;#252;€’“ &amp;amp;amp;lt;  &amp;amp;amp;gt;  &amp;amp;amp;lt;   &amp;amp;amp;gt;  &amp;amp;amp;#39;    &amp;amp;amp;#39;   &amp;amp;amp;quot;   &amp;amp;amp;quot;   &amp;amp;amp;#39;\nFrom Web App”
</code></pre>

<p>And I want to return it in the same format</p>

<p>And if incoming string is <code>“Proc. Reg. da Republica 3º Região”</code>
I’m suppose it to post in the same way</p>

<p>All the data is first saved to file and then operations performed on it.</p>

<p>please suggest</p>