WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 13 days ago

#47912 accepted defect (bug)

Non-visible chars in title creates some encoded values in permalink

Reported by: dhanendran Owned by: SergeyBiryukov
Milestone: 5.4 Priority: normal
Severity: major Version: 5.2.2
Component: Permalinks Keywords: has-patch has-unit-tests needs-testing
Focuses: ui, rtl, administration Cc:
PR Number:

Description

When someone copy past some values from word documents, some other editor or some site on the web, we end-up copying some non visible chars and pasting it in the WordPress post title. This creates some encoded values in the permalink.
https://dhanendranrajagopal.me/wp-content/uploads/2019/08/non-visible-chars-in-title.png

[In this link|https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8192&number=128] there are so many non visible characters which can be easily added in to the post title. There are other examples as well for this issue one of them is [Byte Order Mark|https://en.wikipedia.org/wiki/Byte_order_mark].

sanitize_title() function only removes the accents from the title not these kind of characters.

I have searched all the open tickets in trac and couldn't find anything related to this issue, so opening one.

Attachments (1)

47912.diff (1.4 KB) - added by dhanendran 2 months ago.
added patch and unit test

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
2 months ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

Hi @dhanendran, welcome to WordPress Trac! Thanks for the report.

sanitize_title() indeed does not remove this kind of characters, but sanitize_title_with_dashes() does.

Looks like we need to add some more characters there.

#2 @SergeyBiryukov
2 months ago

  • Keywords needs-patch needs-unit-tests added

#3 @SergeyBiryukov
2 months ago

The characters are generally added on a case-by-case basis, not all at once.

Let's start with these two here:

@dhanendran
2 months ago

added patch and unit test

#4 @dhanendran
2 months ago

  • Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed

@sergeybiryukov I have added the patch with unit test.

Last edited 2 months ago by dhanendran (previous) (diff)

This ticket was mentioned in Slack in #core by marybaum. View the logs.


2 weeks ago

#7 @garrett-eclipse
2 weeks ago

  • Keywords needs-testing added

@SergeyBiryukov will you have time to review for 5.3?

#8 @SergeyBiryukov
13 days ago

  • Milestone changed from 5.3 to 5.4
Note: See TracTickets for help on using tickets.