将字符ā替换为html实体ā

I'm having a really hard time trying to replace a certain character with it's entity equivalent. I tried to str_replace the character "ā" but it just wont work! I can't see why. The code I use:

$content = str_replace('ā', 'ā',$content);

If anyone has some tips or maybe even an explanation of why it doesn't work, please let me know!

UPDATE:

While above code doesn't replace the character with the entity (don't understand why) that is not the main problem. The character shows up fine, but when I read this page using file_get_contents and after that insert the read HTML into a database the character gets mangled. It's already mangled in the database in which it was inserted.

All headers as suggested below are UTF-8, database tables have UTF-8 encoding, files are UTF-8...

As a quick fix I wanted to convert the char to it's entity before insert into that DB.

Try this: header('Content-Type: text/html; charset=utf-8'); This will make your page display all the legal characters by UTF8, place this code on your page right after <?php

UPDATE: Try at every connection to DB:

    $connect = YOUR_MYSQL_CONNECTION();

    mysql_query( "SET NAMES 'utf8';" , $connect );

    mysql_query( "SET CHARACTER SET 'utf8';" , $connect );

Is the larger string which contains ā easily accessible? If so, the htmlentities function should do the job. It should convert all characters with an HTML equivalent to that equivalent. However, it'll also convert the likes of < into &lt;.