510 posts
  • Beta Tester
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 1 000 and 5 000 dollars
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
  • Canada
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 5-6 years
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
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
  • Beta Tester
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 1 000 and 5 000 dollars
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
  • Canada
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 5-6 years
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
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
  • Beta Tester
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 1 000 and 5 000 dollars
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