Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I was asking about the way to properly maintain characters from appearing in ASCII once the email is dispatched from the PHP email script.

For example, if an email is sent with the following subject:

This is a 'SUBJECT' but "what" is the <encoding>?

It arrives as:

This is a \&#39;SUBJECT\&#39; but \&#34;what\&#34; is the ?

The variable the subject is being retrieved from is echo stripslashes($_POST['subject'])

I was told I could use htmlentities but I'm getting nothing but errors. I'm also trying to use stripslashes along with it.

What is the proper setting for htmlentities to respect everything as it is instead of trying to break it down into ASCII?

I've tried a few different ones but most returned errors or didn't do what was desired.

echo htmlentities(stripslashes($_POST['subject'], ENT_COMPAT | ENT_HTML401, "UTF-8"))

Can anyone tell me what I'm doing wrong? I'm not sure if I'm using the proper parameters or syntax. http://php.net/manual/en/function.htmlentities.php

share|improve this question
 
Look at the parenthesis. Which belong to which function? Are you passing the charset and flags to htmlentities to which they belong? –  mario Mar 13 '13 at 3:11
 
Oh, and just disable the frigging magic_quotes. Or use one of the workarounds from the manual to apply stripslashes centrally. –  mario Mar 13 '13 at 3:13
 
Email and encodings is not a short topic as Joel on software pointed out. But yes first make sure your parentheses are correct. –  Daniel Williams Mar 13 '13 at 3:16
 
magic_quotes isn't enabled. I'm using PHP 5.4. And there's a way to apply stripslashes centrally? –  popsicle Mar 13 '13 at 3:18
 
Why are you trying to apply it anyway then? –  mario Mar 13 '13 at 3:19
show 3 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.