Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#45478 closed enhancement (reported-upstream)

Post slug contains Vietnamese characters

Reported by: anonymized_15729769's profile anonymized_15729769 Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords:
Focuses: Cc:

Description

In WP 5.0 + Gutenberg Editor,

If my post like "Some characters: Những ký tự tiếng việt" (contains ":" character), then the post slug is auto set to "some-characters-những-ký-tự-tiếng-việt", I think it should be "some-characters-nhung-ky-tu-tieng-viet"

Attachments (1)

45478.png (8.8 KB) - added by SergeyBiryukov 6 years ago.

Download all attachments as: .zip

Change History (19)

#1 @Joen
6 years ago

  • Keywords 2nd-opinion added
  • Type changed from defect (bug) to enhancement

I can confirm that if you add the suggested phrasing, the previewed permalink does not appear to be sanitized. However the published version has a sanitized slug, and if you reload the editor you'll see the accurate slug represented.

Screenshots: https://cloudup.com/cDhLpMIBITM

The enhancement we could make is to do this sanitization _before_ publish also, so it would match the before and after. I would suggest this could be done in a future release. Thanks for the ticket!

#2 @lonelyvegan
6 years ago

  • Milestone changed from Awaiting Review to Future Release

Agreed that we should handle this in an upcoming patch 👍🏻

#3 @SergeyBiryukov
6 years ago

  • Keywords needs-patch needs-unit-tests added; 2nd-opinion removed

#4 @SergeyBiryukov
6 years ago

  • Milestone changed from Future Release to 5.0.1
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

@SergeyBiryukov
6 years ago

#5 follow-up: @SergeyBiryukov
6 years ago

To clarify a bit more, it looks like neither sanitize_title() nor wp_unique_post_slug() runs until publishing.

А post titled Hello, world! shows hello,-world! in the previewed permalink, see 45478.png.

After publishing, the actual slug was hello-world-2, because it was a second post with that title.

Last edited 6 years ago by SergeyBiryukov (previous) (diff)

#6 in reply to: ↑ 5 @SergeyBiryukov
6 years ago

Replying to SergeyBiryukov:

А post titled Hello, world! shows hello,-world! in the previewed permalink, see 45478.png.

  • If I edit the slug to hello,-world!!! and click "Save" on the permalink input, it stays as entered. At this point, it's not sanitized and not saved to database yet.
  • If I click "Save Draft" then, it changes to hello-world. sanitize_title() appears to run now, for some reason only if you manually edit slug. wp_unique_post_slug() does not run at this point. In the database, post_name now has this temporary value.
  • If I publish the post, it changes to hello-world-2. sanitize_title() and wp_unique_post_slug() finally run without depending on manual slug edits, and post_name is now correct in the database.

Would be great to have some consistency here :)

#7 @pento
6 years ago

  • Milestone changed from 5.0.1 to 5.0.2

#8 @SergeyBiryukov
6 years ago

  • Component changed from Permalinks to Editor

#9 @SergeyBiryukov
6 years ago

#45588 was marked as a duplicate.

#10 @pento
6 years ago

  • Milestone changed from 5.0.2 to 5.0.3

#11 @audrasjb
6 years ago

  • Milestone changed from 5.0.3 to 5.1

Hello,

5.0.3 is going to be released in a couple of weeks.

It doesn't appear this ticket can be handled in the next couple of weeks (still needs a patch, unit-tests and actual testing). Let's address it in 5.1 which is coming in February. Feel free to ask for changing the milestone if you think this issue can be quickly resolved.

Cheers,

Jb

#12 @pento
6 years ago

  • Keywords needs-patch needs-unit-tests removed
  • Milestone 5.1 deleted
  • Resolution set to reported-upstream
  • Status changed from accepted to closed

This is an issue with how the block editor generates the post slug for previewing. The slug is generated client side, which doesn't have an equivalent of sanitize_title().

I'm going to close this issue in favour of GB12907, as it needs to be handled in the block editor JS.

#13 @ocean90
5 years ago

#46088 was marked as a duplicate.

#14 @SergeyBiryukov
5 years ago

#47532 was marked as a duplicate.

#15 @SergeyBiryukov
4 years ago

#50246 was marked as a duplicate.

#16 @SergeyBiryukov
4 years ago

Looks like GB12907 is now fixed, but only the initial issue about punctuation, not the ones about sanitizing special characters in other languages: GB16695 or GB18177, which were both closed as duplicates.

Per https://github.com/WordPress/gutenberg/pull/21007:

This fixes the original issue from GB12907 regarding punctuation in the slug. It doesn't resolve the related issues referenced there that were opened for characters in other languages (such as German and Danish) not being converted properly. If we merge this and close GB12907, we may want to reopen one of those that was closed as a duplicate in order to keep a more accurate record.

So either GB16695 or GB18177 should be reopened.

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


4 years ago

#18 @SergeyBiryukov
3 years ago

#54492 was marked as a duplicate.

Note: See TracTickets for help on using tickets.