Ticket #6637 (closed defect: fixed)

Opened 5 months ago

Last modified 1 month ago

wp_widget_categories() doesn't handle html entities in description

Reported by: guillep2k Assigned to: guillep2k
Priority: normal Milestone: 2.6
Component: i18n Version: 2.5
Severity: normal Keywords: has-patch tested
Cc: guillep2k

Description

At wp-includes/widgets.php:694, the following line:

wp_dropdown_categories($cat_args . '&show_option_none= ' . __('Select Category'));

Doesn't handle html entities coming from __() translation, since they contain ampersands. To correct this, we can change it to:

wp_dropdown_categories($cat_args . '&show_option_none= ' . urlencode(__('Select Category')));

This is easily seen in Spanish (es_ES.po file can be found here: http://reyson.re.funpic.de/downloads/wp2.5-es_ES-po.rar), where 'Select Category' translates to 'Seleccionar Categoría'.

Attachments

6637.diff (0.5 kB) - added by guillep2k on 05/01/08 22:39:05.
6637-array.diff (0.6 kB) - added by ryan on 05/01/08 23:04:17.

Change History

04/08/08 00:22:44 changed by guillep2k

  • cc set to guillep2k.
  • component changed from General to i18n.

05/01/08 22:39:05 changed by guillep2k

  • attachment 6637.diff added.

05/01/08 22:39:46 changed by guillep2k

  • keywords set to has-patch.
  • milestone changed from 2.7 to 2.5.2.

Added a patch for the proposed change.

05/01/08 22:43:01 changed by guillep2k

  • status changed from new to assigned.

05/01/08 22:49:29 changed by guillep2k

  • keywords changed from has-patch to has-patch tested.

Tested the patch in 2.5.1 with LANG = es_ES. The "Select Category" option is translated to "Seleccionar Categoría"; without the patch it's shown as "Seleccionar Categor", as the í is taken as another query variable.

05/01/08 23:04:17 changed by ryan

  • attachment 6637-array.diff added.

(follow-up: ↓ 6 ) 05/01/08 23:04:48 changed by ryan

We should use the array calling style to avoid the vagaries of query strings. Try out this patch.

(in reply to: ↑ 5 ) 05/01/08 23:18:30 changed by guillep2k

Replying to ryan:

We should use the array calling style to avoid the vagaries of query strings. Try out this patch.

New patch works perfect for me. I applied it to 2.5.1, though, which is what my wife has on her blog (not trunk).

05/02/08 16:59:51 changed by ryan

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7872]) Use array calling style. Props guillep2k for the find. fixes #6637 for trunk

05/02/08 17:00:17 changed by ryan

(In [7873]) Use array calling style. Props guillep2k for the find. fixes #6637 for 2.5

07/15/08 16:24:07 changed by ryan

  • milestone changed from 2.5.2 to 2.9.

Milestone 2.5.2 deleted

07/30/08 20:32:01 changed by westi

  • milestone changed from 2.9 to 2.6.