Skip to content

Commit 1113c24

Browse files
committed
General: Add support for unicode email addresses in sanitise_email
Related to #31992.
1 parent 4565b06 commit 1113c24

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/formatting.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3787,7 +3787,7 @@ function sanitize_email( $email ) {
37873787
* LOCAL PART
37883788
* Test for invalid characters.
37893789
*/
3790-
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
3790+
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.\x80-\xff-]/', '', $local );
37913791
if ( '' === $local ) {
37923792
/** This filter is documented in wp-includes/formatting.php */
37933793
return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
@@ -3828,7 +3828,7 @@ function sanitize_email( $email ) {
38283828
$sub = trim( $sub, " \t\n\r\0\x0B-" );
38293829

38303830
// Test for invalid characters.
3831-
$sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
3831+
$sub = preg_replace( '/[^a-z0-9\x80-\xff-]+/i', '', $sub );
38323832

38333833
// If there's anything left, add it to the valid subs.
38343834
if ( '' !== $sub ) {

0 commit comments

Comments
 (0)