Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAndraž Lazi?
3,130 PointsStrange characters in email. How to correct that in this particular example?
When the form is submited the email subject and also the content have strange characters (like: PovpraÅ¡evanje | ÄŒofot Ä ikor). I am not using English. How to fix traht problem?
2 Answers
chrisp
13,686 PointsBecause its not english, you can try to parse it through some function like =>
utf8_decode(' strings ') htmlentities(' stings ') html_entity_decode(' string' )
I am not sure what you are trying to do, but hopefully may work out for you
chrisp
13,686 PointsMaybe somewhere you mention that has the parsing error, was it subject and contents? I would try something like this.
$subject = "Shirts 4 Mike Contact Form Submisstion |" . $name;
$mail-> Subject = utf8_decode($subject);
$mail-> MsgHTML(utf8_decode($email_body));
That should parse any strange characters in your email. I hope that works.
Andraž Lazi?
3,130 PointsI just implemented that but it didn't work -.-. Thanks anyway.
Andraž Lazi?
3,130 PointsAndraž Lazi?
3,130 PointsI am aware of that but where to put that? Is it isomwhere inside that code that is below from the contact.php at Shirts4Mike?
$email_body = ""; $email_body = $email_body . "Name: " . $name . "<br>"; $email_body = $email_body . "Email: " . $email . "<br>"; $email_body = $email_body . "Message: " . $message;
Or do I need to include it somewhere else?