Display issues with accents in Chrome and Safari
Solved
jenny131078
Posted messages
177
Status
Member
-
Jeanbat92 -
Jeanbat92 -
Hello,
I know this is a very common issue, but I have searched the internet and all the possible forums, and I cannot resolve my problem.
Here, I have created a website in PHP mainly for include functions and forms since I am not using a database yet, which will come later...
I have a well-known issue with displaying accents, but only in Chrome and Safari browsers. The idea is, of course, for my site to display correctly in any browser!
All my pages have the line <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>, and my stylesheet is also created with @charset "UTF-8".
I have tested several lines of code that I found online using htmlentities, but none of them work; the accents/apostrophe, etc. do not display correctly.
I must be missing a step, but which one? I really don't want to have to retype all my special characters one by one :(
Is there anyone who can help me? Just so you know, I’m a beginner in PHP :o
Thank you in advance
Configuration: Windows 7 / Firefox 18.0
I know this is a very common issue, but I have searched the internet and all the possible forums, and I cannot resolve my problem.
Here, I have created a website in PHP mainly for include functions and forms since I am not using a database yet, which will come later...
I have a well-known issue with displaying accents, but only in Chrome and Safari browsers. The idea is, of course, for my site to display correctly in any browser!
All my pages have the line <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>, and my stylesheet is also created with @charset "UTF-8".
I have tested several lines of code that I found online using htmlentities, but none of them work; the accents/apostrophe, etc. do not display correctly.
I must be missing a step, but which one? I really don't want to have to retype all my special characters one by one :(
Is there anyone who can help me? Just so you know, I’m a beginner in PHP :o
Thank you in advance
Configuration: Windows 7 / Firefox 18.0
6 answers
-
Hello,
After months of struggle, looking through all the forums, I knew that I didn't have a browser issue (utf-8 encoding, etc.) since I had uninstalled and then reinstalled Chrome and the problem also occurred in Safari.
Here's how I solved the problem on my end. It was a font issue in Windows 7.
Control Panel > Appearance and Personalization > Fonts
And there I uninstalled all the Helvetica fonts.
Then I restarted Chrome and the problem was solved.
I hope this works for you.
See you later! -
Hello,
Have you selected, in your notepad editor for example
Encoding => UTF-8 ?
Or just remove the <meta http-equiv=""Content-type"" content=""text/html;" charset="utf-8"/>" altogether="" />
----
Passionate about computers and video games -
Idem for receiving emails from my form :(
All the accents are coded, making the messages unreadable...
Here is my form. If you have any suggestions, they are more than welcome
<?php
$nom = htmlentities($_POST['nom'], ENT_QUOTES);
$telephone = htmlspecialchars($_POST['telephone'], ENT_QUOTES);
$email = htmlspecialchars($_POST['mail'], ENT_QUOTES);
$message = htmlentities($_POST['message'], ENT_QUOTES);
/*variables*/
if(!isset($email) OR $email == "")
$email = "No email provided";
if(!isset($message) OR $message == "")
$message = "No message typed";
/*email*/
$msg = "<p>You have received a message from the website form: http://www.monsite.com<br />
Here is the information: <br /><p>
Name: $nom <br />
Phone: $telephone <br />
Email: $email <br /><p>
Message: $message</p>";
/*header*/
$mail = htmlspecialchars($_POST['mail'], ENT_QUOTES);
$mail = htmlentities($_POST['mail'], ENT_QUOTES);
if(isset($mail))
$header = "From: \"$nom\" <$mail>\r\n";
else
$header = "From: \"$nom\" <contact@monsite.com>\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=UTF-8\r\n";
$header .= "To: \"My Site\" <contact@ocups.com>\r\n";
$subject = htmlspecialchars($_POST['sujet'], ENT_QUOTES);
$subject = htmlentities($_POST['sujet'], ENT_QUOTES);
/*send mail*/
if(mail("contact@monsite.com", $subject, $msg, $header))
{
header('Location: ../pages/merci.php');
}
else
{
echo "<strong style=\"color:#ff0000;\">Due to an error, your message has not been sent. Please try again.</strong>";
}
?> -
I work with Dreamweaver when I create a page it automatically enters:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
and the style sheets
@charset "utf-8";
/* CSS Document */ -
I deleted the line <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> and checked the encoding in Notepad by opening my index page and I am in UTF-8 (without BOM).
Likewise, the characters are still encoded... -
Anyone have a little piece of code to share to help me avoid recoding all my special characters one by one? :(