?
Solved

php email - ignores £ in body

Posted on 2012-03-28
7
Medium Priority
?
252 Views
Last Modified: 2012-04-02
Hi

I am sending out an email with php.

If the body of the email contains '£' the whole email is blank.

If I use '£' It simply ignores it.

Here's the basis of the function ..

$header = "Content-Type: text/html; charset=utf8";
$subject = "My Subject Here";
$body1 = "This is the first section where I try £15";
$body2 = "This is the second section where I try £15";
$from = "My From Address";
$language = language_default();
$params = array();
$message['subject'] = $subject;
		$message['body'] = array();
		$message['body'][] = $body1;
		$message['body'][] = $body2;

Open in new window

0
Comment
Question by:eppyfone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 37776216
do u have like this full mime header,


// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
0
 

Author Comment

by:eppyfone
ID: 37776260
Hi

Yes

Still no success..
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 37776269
You probably have other errors, but this line will cause an encoding collision between the unicode marker and the single-byte characters with ordinal values above 128.
$header = "Content-Type: text/html; charset=utf8";

Open in new window

Please read this article about unicode and then post back if you still have questions.
http://www.joelonsoftware.com/articles/Unicode.html

Executive Summary: Remove UTF-8 and insert ISO-8859-1.  But read the article to learn why so you don't have this situation again.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:Kim Walker
ID: 37776272
Try quoted_printable_encode your message.
quoted_printable_encode($message);

Open in new window

0
 

Accepted Solution

by:
eppyfone earned 0 total points
ID: 37776740
1. Ray Passeur - thanks for the attempt at trying to teach me to fish. No use. and your Exec Summary didn't work ..

2. xmediaman - nope

Solution by me :

Added this line

            $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';

Thanks for your attention

E.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 37776773
Yeah, that's the problem with posting little code fragments.  It's almost impossible to guess at what else is going on.  We could see that your script had set a lot of variables, but nowhere was there a function call that used any of those variables.  So all we could do is guess at the more common errors associated with character encodings.

Anyway, glad you've found the issue.  Best regards, ~Ray
0
 

Author Closing Comment

by:eppyfone
ID: 37795082
Solved by research elsewhere.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question