将字符串保存到变量charset问题php

so I have a string as follows

Início

Now on my webpage if I input that text directly in the html it displays fine, no issues. Although if I save it into a variable first

$var = 'Início';

then echo the variable in the html to display it the í is showing as an unknown character.

Any ideas? Do I need to set the charset in php or use iconv to convert it to the right charset?

Thanks

Try mb_internal_encoding, see documentation here: http://www.php.net/manual/en/function.mb-internal-encoding.php

Also make sure, that your file is utf-8 encoded.