如何在创建的文件上设置UTF-8

how can i set charset to UTF-8 on a file created by php? i create my file like this:

if(!file_exists("games/".strtolower($dir)."/index.php")) {
        $create_index = fopen("games/".strtolower($dir)."/index.php", "w");
        $name = $row['name'];
        $content  = mb_convert_encoding($content,'UTF-8');
        $string = "
        <?php
        include '../../config.php';
        include('../../default_theme.php');
        setTitle(\"".$name."\");
        show(\"".$name."\");
        ";
        fwrite($create_index, $content);
        fwrite($create_index, $string);
        fclose($create_index);
    }

but then ä, ö and ü are displayed as ?�

thanks for ur help