Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#44085 closed defect (bug) (invalid)

url_encode($string) does not encode dashes properly

Reported by: sjcglads's profile sjcglads Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.5
Component: General Keywords: needs-screenshots needs-patch needs-testing
Focuses: coding-standards Cc:

Description

Blog post titles with dashes in them are not being encoded properly into email subject lines when using url_encode($string).

For an example, navigate to my client's recent blog post, scroll down until the sharing buttons are visible on the left, and select the Email share option.

Notice that the dash is not properly encoded in the Subject Line of the email.

Change History (1)

#1 @johnbillion
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi @sjcglads , welcome to WordPress Trac.

Are you talking about the urlencode() function? If so, this is part of PHP, not WordPress.

Regardless, the problem is actually because your post title has had its entities HTML encoded before being passed to the email link. You need to run html_entity_decode() on the post title beforehand.

Note: See TracTickets for help on using tickets.