[wp-trac] [WordPress Trac] #30204: wp_mail() bug with UTF-8-named attachment
WordPress Trac
noreply at wordpress.org
Thu Oct 30 23:29:07 UTC 2014
#30204: wp_mail() bug with UTF-8-named attachment
---------------------------------+-----------------------------
Reporter: Blue Liquid Designs | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version: trunk
Severity: normal | Keywords:
Focuses: |
---------------------------------+-----------------------------
Hi,
I came across a problem with phpmailer when attaching UTF-8 encoded files
to the email. The file is correctly sent but the attached filename is
incorrect.
For instance, Τεστ1_Τεστ2.pdf becomes 1_Τεστ2.pdf.
I tracked it down to line 1984 of /wp-includes/class-phpmailer.php, which
is
{{{
$filename = basename($path);
}}}
From the research I did, unless the correct locale has been set using
setlocale() before running basename() problems like this will occur.
The simple solution would be to run setlocale() for the correct language
before sending mail, but it's not possible to determine the correct locale
if you have users who write in multiple languages using the website.
Since WordPress has been pushing internationalisation hard in the last few
updates this seems like another good step forward to support multi-
languages.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30204>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list