[wp-trac] [WordPress Trac] #44958: &nbsp character in title generates a permalink (and slug) with space

WordPress Trac noreply at wordpress.org
Sun Jun 23 13:27:13 UTC 2024


#44958: &nbsp character in title generates a permalink (and slug) with space
-------------------------------------------------+-------------------------
 Reporter:  ace2_heart                           |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.6
Component:  Permalinks                           |     Version:  4.8
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing has-patch has-         |     Focuses:
  testing-info has-screenshots needs-unit-tests  |
-------------------------------------------------+-------------------------

Comment (by dmsnell):

 Today I took some time to expand the work in [https://github.com/wordpress
 /wordpress-develop/pull/5466 #5466]. The new `slugify()` function is the
 important part to examine. Here are some thoughts:

  - converting all forms of allowable input escaping into Unicode code
 points does indeed collapse much of the logic and eliminate //by default//
 cases where something could escape the checks, for example, because it's a
 numeric character reference.

  - this is another potentially great use case for the `WP_Token_Map` for
 rewriting given characters in the title.

  - `slugify()` runs in one single pass through the input string and its
 main loop represents all of the core logic at each decoded cahracter. to
 my head this is clearer than jumping between multiple full passes and
 string-replaces

 There's a lot to consider, but I think this has promise, and the changes
 to the HTML API in WordPress 6.6 are going to make it much easier to do
 the conversion. Looks like we could improve Core's UTF-8 functions though.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44958#comment:36>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list