views:

219

answers:

1

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: [email protected]' . "\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ž podjetja:</p> 

Did anyone encounter this problem?

A: 

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

Mladen