Ticket #10966 (closed defect (bug): fixed)

Opened 3 years ago

Last modified 13 months ago

bug: Post Slug in Quick-Edit mode for non-english languages

Reported by: ramiy Owned by: dwright
Priority: high Milestone: 2.9
Component: Quick/Bulk Edit Version: 2.9
Severity: normal Keywords: has-patch needs-testing 2nd-opinion
Cc: r_a_m_i@…, david_v_wright@…

Description

I use WP in hebrew.

When i edit posts using "Posts Edit SubPanel", i see the Slug in hebrew letters (pic1.png).

When i edit posts using "Quick Edit" the Slug shows gibberish letters (pic2.png).

Please fix this annoying bug.

Attachments

pic1.PNG Download (45.5 KB) - added by ramiy 3 years ago.
pic2.PNG Download (42.7 KB) - added by ramiy 3 years ago.
category.php.diff Download (1.4 KB) - added by dwright 3 years ago.
wp-includes/category.php.patch file
bug-10966-issue-cat1.png Download (11.4 KB) - added by dwright 3 years ago.
demonstrates issue using slug of string 'internationalizætiøn'
bug-10966-issue-cat1-edit.png Download (11.9 KB) - added by dwright 3 years ago.
demonstrates issue using slug of string 'internationalizætiøn' (edit mode)
bug-10966-issue-quick-edit.png Download (27.3 KB) - added by dwright 3 years ago.
demonstrates issue using slug of string 'internationalizætiøn' (Quick Edit)
bug-10966-fix-cat1.png Download (4.9 KB) - added by dwright 3 years ago.
demonstrates resolution of issue using slug of string 'internationalizætiøn'
bug-10966-fix-cat1-edit.png Download (11.3 KB) - added by dwright 3 years ago.
demonstrates resolution of issue using slug of string 'internationalizætiøn' (edit mode)
bug-10966-fix-quick-edit.png Download (26.6 KB) - added by dwright 3 years ago.
demonstrates resolution of issue using slug of string 'internationalizætiøn' (Quick Edit)
template.php.diff Download (3.0 KB) - added by dwright 3 years ago.
newest patch for wp-admin/includes/template.php

Change History

ramiy3 years ago

ramiy3 years ago

  • Component changed from General to Quick Edit

dwright3 years ago

wp-includes/category.php.patch file

dwright3 years ago

demonstrates issue using slug of string 'internationalizætiøn'

dwright3 years ago

demonstrates issue using slug of string 'internationalizætiøn' (edit mode)

dwright3 years ago

demonstrates issue using slug of string 'internationalizætiøn' (Quick Edit)

dwright3 years ago

demonstrates resolution of issue using slug of string 'internationalizætiøn'

dwright3 years ago

demonstrates resolution of issue using slug of string 'internationalizætiøn' (edit mode)

dwright3 years ago

demonstrates resolution of issue using slug of string 'internationalizætiøn' (Quick Edit)

  • Cc david_v_wright@… added
  • Keywords has-patch needs-testing 2nd-opinion added

What I understand this issue to be:

This issue demonstrates that the slug displays to the user in it's (url) encoded form.

The slug is used in urls.

 http://www.faqs.org/rfcs/rfc1738.html

URLs are written only with the graphic printable characters of the US-ASCII coded character set. The octets 80-FF hexadecimal are not used in US-ASCII, and the octets 00-1F and 7F hexadecimal represent control characters; these must be encoded.

So, while the slug appears to the end user as 'gibberish letters' it is actually the (properly) encoded version of the string.

To resolve this issue, display the slug to the user decoded. (i.e. so it looks like it did when they created it)

I don't know Hebrew, so to recreate this issue, I set the slug to name that contains non US-ASCII characters.

Categories -> Category Name (testing) -> Category Slug (internationalizætiøn)

see attached before and after screen shots.

see attached patch files

these changes 'work', I'm just not sure it's the most appropriate/elegant solution, someone more familiar with the code base should review. (I believe I have added the necessary keywords)

It needs more work.

the slug problem exists in:

  • Post Edit - wp-admin/edit.php
  • Tag Edit - wp-admin/edit-tags.php
  • Page Edit - wp-admin/edit-pages.php
  • Category Edit - wp-admin/categories.php
  • Link Category Edit - wp-admin/edit-link-categories.php
  • Owner set to dwright
  • Status changed from new to accepted

Post Edit - wp-admin/edit.php

  • can't recreate. not sure how, what is 'Post Edit'? 'Quick Edit' displays slug correctly for me

Can you provide a screen shot or steps for how to recreate the issue?

Tag Edit - wp-admin/edit-tags.php

  • confirmed, displays incorrectly, I can fix this.

Page Edit - wp-admin/edit-pages.php

  • where? 'Quick Edit' displays slug correctly for me Can you provide a screen shot or steps for how to recreate the issue?

works for me: Category Edit - wp-admin/categories.php

  • displays slug correctly for me Can you provide a screen shot or steps for how to recreate the issue?

Link Category Edit - wp-admin/edit-link-categories.php

  • displays incorrectly, will fix this.

see template.php.diff "newest patch for wp-admin/includes/template.php"

should resolve: Tag Edit - wp-admin/edit-tags.php

dwright3 years ago

newest patch for wp-admin/includes/template.php

see template.php.diff "newest patch for wp-admin/includes/template.php"

should resolve: Link Category Edit - wp-admin/edit-link-categories.php

Again, more information needed to address:

Post Edit - wp-admin/edit.php

Page Edit - wp-admin/edit-pages.php

Category Edit - wp-admin/categories.php

Lets summarize your edit in wp-admin/includes/template.php file:

  • Tag Edit - _tag_rows() function fixed
  • Category Edit - _cat_row() function fixed
  • Link Category Edit - link_cat_row() function fixed
  • Post Edit - line_edit_row() function fixed (Quick Edit Mode)
  • Page Edit - line_edit_row() function fixed (Quick Edit Mode)

i think you fixed all the problems. needs-testing.

comment:8 follow-up: ↓ 9   ryan3 years ago

  • Milestone changed from 2.9 to Future Release

comment:9 in reply to: ↑ 8   ramiy3 years ago

  • Milestone changed from Future Release to 2.9

Replying to ryan:

Why "future release"? dwright fixed this bug!

See also #6915

Right now all enhancements are being moved out of 2.9 in preparation for release. I'll see if the i18n maintainer wants to make this an exception though.

  • Severity changed from critical to normal

Both #6915 and #10966 fix the same bug for non english languages in post slug using 'editable_slug' filter.

#6915 fixed:

  • wp-admin/includes/post.php
  • wp-admin/edit-link-category-form.php
  • wp-admin/edit-tag-form.php
  • wp-admin/edit-category-form.php

#10966 fixes:

  • wp-includes/category.php
  • wp-admin/includes/template.php

Ticket #6915 did not fix all the slug problems. In ticket #10966 dwright fexed few more slug bugs.

The template.php.diff last patch looks good.

Any time a slug is saved it goes through urlencode (which isn't actually needed, but that's another discussion), so this patch won't break any existing slugs.

  • Status changed from accepted to closed
  • Resolution set to fixed

(In [12277]) Apply editable_slug filter in more places. Props dwright. fixes #10966

Related: #16999.

Note: See TracTickets for help on using tickets.