iconv not working when dynamic variable is used
<p>I am using following code to convert spanish characters to normal English characters:</p>

<pre><code>function test_enc($text)
{
    setlocale(LC_ALL, 'en_US.utf8');
    return iconv('utf8', 'ascii//TRANSLIT', $text);
}
echo test_enc('TéstFirst'); returns TestFirst
</code></pre>

<p>and it is working fine, but when I am passing this argument dynamically from other array having same value then it is returning nothing like:</p>

<pre><code>echo test_enc($data['firstname']);
</code></pre>

<p>I have used var_dump to see the difference and it returned following:</p>

<pre><code>var_dump('TéstFirst');//returned string(10) "TÃ©stFirst"
var_dump($data['travelername']);// returned string(9) "TéstFirst"
</code></pre>

<p>Please let me know what I am doing wrong.</p>