开发者

php mail + utf-8 = problem in Internet explorer

I have a form on a page that sends data to php file via ajax request. The data is then collected into a single variable and sent to email specified in the php file. The data is in slovenian an uses a lot of letters that use diacritics (š,ć,ž). Everything works fine when the form is submitted from any browser that isn't Internet Explorer, but when sent from IE, email contains some gibberish charachters instead of letters with diacritics...

I specified mail headers in php file like this:

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html;charset=UTF-8' . "\r\n";
$headers .= 'From: xxx@yyy.si' . "\r\n";

the form is:

        <form id="order" class="order" name="form299" action="orderForm.php" method="POST">
            <fieldset>
             <p>Ime Priimek / Naziv 

    podjetja:</p>

 .....   
         <p>Naslov / Sedež podje开发者_如何学Pythontja:</p> 

Did anyone encounter this problem?


I found a cause of this problem, it's urlencoding in javascript... Beginner's mistake :)

I just added

encodeURI('element.value') 

for each field that I am sending via ajax, and it worked perfectly

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜