Swedish characters php

marwan29
3 Posts
marwan29 posted this 30 March 2021
Ask a Question

Hi, I am using your php "Create a Simple HTML Contact Form"
I get it from this page:
https://nicepage.com/doc/25066/create-a-simple-html-contact-form
"Code Example 1"

Its working fine, but when I receive any email with swedish characters, it become like this: ä ö å
I have tried to add UTF-8 in many ways but its not working.
Would you please tell me how to get it work.
Thanks

Hi, I am using your php "Create a Simple HTML Contact Form" I get it from this page: https://nicepage.com/doc/25066/create-a-simple-html-contact-form "Code Example 1" Its working fine, but when I receive any email with swedish characters, it become like this: ä ö å I have tried to add UTF-8 in many ways but its not working. Would you please tell me how to get it work. Thanks

Last edited 30 March 2021 by marwan29

Vote to pay developers attention to this features or issue.
4 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 30 March 2021

Hi,

The general recommendation is to add Content-Type:text/html;charset=utf-8 to the email headers in a standard way.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi, The general recommendation is to add *Content-Type:text/html;charset=utf-8* to the email headers in a standard way. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
marwan29
3 Posts
marwan29 posted this 30 March 2021

Thank you,
Actualy I don't understand where to put it.
I use "contact.php" file, and the content of this file is look like this:

<?php $field_name $field_email $field_message specify the message recipient: $mail_to ; $mail_from ; $subject .$field_name; the email content: $body_message .$field_name."\n"; $body_message . .$field_email."\n"; $body_message . .$field_message; $headers .$mail_from."\r\n"; $headers . .$field_email."\r\n"; $mail_status $subject, $body_message, $headers); show a json message about the successful or unsuccessful sending a message if ($mail_status) { $resarray?> true);
header('Content-Type: application/json');
echo json_encode($resArray);
} else {
$resArray= array('success' => false);
header('Content-Type: application/json');
echo json_encode($resArray);
}
?>

So where to put "Content-Type:text/html;charset=utf-8" ?

Thanks

Thank you, Actualy I don't understand where to put it. I use "contact.php" file, and the content of this file is look like this: &lt;?php $field_name $field_email $field_message specify the message recipient: $mail_to ; $mail_from ; $subject .$field_name; the email content: $body_message .$field_name.&quot;\n&quot;; $body_message . .$field_email.&quot;\n&quot;; $body_message . .$field_message; $headers .$mail_from.&quot;\r\n&quot;; $headers . .$field_email.&quot;\r\n&quot;; $mail_status $subject, $body_message, $headers); show a json message about the successful or unsuccessful sending a message if ($mail_status) { $resarray?&gt; true); header('Content-Type: application/json'); echo json_encode($resArray); } else { $resArray= array('success' => false); header('Content-Type: application/json'); echo json_encode($resArray); } ?> So where to put "Content-Type:text/html;charset=utf-8" ? Thanks

Last edited 30 March 2021 by marwan29

Support Team
Support Team posted this 31 March 2021

Hi Marwan,

Please try adding this line:

$headers .= "Content-Type:text/plain;charset=utf-8\r\n";

right after this line (in our example):

$headers .= 'Reply-To: '.$field_email."\r\n";

This may help.

...................................................
Sincerely,
Olivia
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Hi Marwan, Please try adding this line: $headers .= "Content-Type:text/plain;charset=utf-8\r\n"; right after this line (in our example): $headers .= 'Reply-To: '.$field_email."\r\n"; This may help. ................................................... Sincerely, Olivia Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
marwan29
3 Posts
marwan29 posted this 31 March 2021

This works perfect, thanks so much

This works perfect, thanks so much
You must log in or register to leave comments