PHP邮件:发送ÅÄÖ字符?

I'm trying to send a mail containing ÅÄÖ characters (Swedish).

I've tried changing the mail header to UTF-8 and iso-8859-1, none of which works. I've also tried wrapping the text in utf8_encode() as well as mb_encode_mimeheader(), with no success. In some cases i get chinese characters instead, not really what i want.

I just tried using htmlentities() with no result.

        $values = array(
            'name' => $this->input->post('name'),
            'email' => $this->input->post('email'),
            'ref' => $this->input->post('ref'),
            'sex' => $this->input->post('sex'),
            'age' => $this->input->post('age'),
            'question' => $this->input->post('msg'),
            'ip' => $_SERVER['REMOTE_ADDR']
        );

        $to      = '@live.se';
        $subject = $values['name'] . ' har skickat en fråga!';
        $message  = 'Namn:'.$values['name']." 
";
        $message .= "
Email:".$values['email']." 
";
        $message .= "
Kön:".(($values['sex'] == 'f') ? 'Kvinna' : 'Man')." 
";
        $message .= "
Ålder:".$values['age']." 
";
        $message .= "
Referensnummer:".$values['ref']." 
";
        $message .= "
Meddelande: 
".$values['question'];

        $headers = 'From: noreply@.se' . "
" .
            'Content-type: text/html; charset=iso-8859-1' . "
" .
            'Reply-To: ' .$this->input->post('email') . "
" .
            'X-Mailer: PHP/' . phpversion();

        $message = htmlentities($message);

        if(@mail($to, $subject, $message, $headers)) {
            if($this->input->is_ajax_request()) {
                echo 1;
            }else {

                $data['message']['header'] = 'Tack så mycket!';
                $data['message']['content'] = 'Din fråga skickades utan problem! Jag återkommer snarast möjligt.';

                echo $this->load->view('includes/header', array(), true);
                echo $this->load->view('message', $data['message'], true);
                echo $this->load->view('includes/footer', array(), true);
            }
        }else {
            $fail = true;
        }

I don't know if this is the best way to achieve this. But I used to use mail like this:

mail($to, "=?utf-8?B?".base64_encode($subject)."?=", $message, $headers);

While trying to figure this out, i remembered i was using Codeigniter, and thought maybe, just maybe, codeigniter had a built in Email library. And, it turns out it does!

So i gave it a shot, and found out it had a serious bug in it. Luckily, i found a fixed version of the file here: http://codeigniter.com/forums/viewthread/87108/P15/#753867

And now it works. I don't know exactly what codeigniter does to make it work, but i'm glad it does!

tl;dr: i don't have a real solution to the problem.

This.

  $message = preg_replace('/[^(\x20-\x7F)]*/','', $message);