510 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+4 more
pxt says

I am trying to get Polish characters to be mailed using PHP . (I don’t speak Polish- for a client)

If I send: (?,?,?,?,?,?,ó,?,? etc.) The email reads: (Ä…,Å›,ć,ż,ź,Ä™,ó,Å‚,Å„ etc.)

I have tried what is written here already: http://www.reynoldsftw.com/2009/09/php-html-email-learnings-with-the-mail-function/

Thanks

499 posts
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in Canada
+2 more
TutelageSystems says

So you have already tried both adding UTF -8 into the mail headers and the changing MySQL?

Care to post a little bit of your code?

510 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+4 more
pxt says
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> 

then later on

$db_charset = mysql_query( "SHOW VARIABLES LIKE 'character_set_database'" );
$charset_row = mysql_fetch_assoc( $db_charset );
mysql_query( "SET NAMES '" . $charset_row['Value'] . "'" );
unset( $db_charset, $charset_row );

$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
    auth();
    $id = htmlentities(strip_tags(filter_input(INPUT_GET, 'w')));
    $eid = htmlentities(trim(strip_tags(filter_input(INPUT_GET, 'id'))));
    $id2 = base64_decode($eid);
    if($_SERVER['REQUEST_METHOD']=='POST') {
        $subject = htmlentities(strip_tags(filter_input(INPUT_POST, 'subject')));
        $email= htmlentities(strip_tags(filter_input(INPUT_POST, 'email')));
        $message = htmlentities(strip_tags(filter_input(INPUT_POST, 'messageReply')));
        if(mail($email, $subject, $message, $headers )) {
            SUCCESS
        } else {
            SHOW ERROR
        }
    } else {
            DO STUFF
    }

499 posts
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in Canada
+2 more
TutelageSystems says

Do you know what character set(s) come back with that query?

Or have you tried specifically telling MySQL to use UTF -8?

SET NAMES utf8;
or
mysql_query( "SET NAMES 'utf8'" );
510 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
+4 more
pxt says

Do you know what character set(s) come back with that query?

Or have you tried specifically telling MySQL to use UTF -8?

SET NAMES utf8;
or
mysql_query( "SET NAMES 'utf8'" );

Hi there,

@TutelageSystems That won’t work as the data is not from MYSQL , it is from the form data.

The solution was to remove the htmlentities() function as it converted all Polish characters into its HTML reference.

Hope this helps someone if they read it ;)

by
by
by
by
by
by