#45478 closed enhancement (reported-upstream)
Post slug contains Vietnamese characters
Reported by: |
|
Owned by: |
|
---|---|---|---|
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)
Change History (19)
#2
@
6 years ago
- Milestone changed from Awaiting Review to Future Release
Agreed that we should handle this in an upcoming patch 👍🏻
#4
@
6 years ago
- Milestone changed from Future Release to 5.0.1
- Owner set to SergeyBiryukov
- Status changed from new to accepted
#5
follow-up:
↓ 6
@
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.
#6
in reply to:
↑ 5
@
6 years ago
Replying to SergeyBiryukov:
А post titled
Hello, world!
showshello,-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()
andwp_unique_post_slug()
finally run without depending on manual slug edits, andpost_name
is now correct in the database.
Would be great to have some consistency here :)
#11
@
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
@
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.
#16
@
5 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.
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!