Make WordPress Core

Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#6637 closed defect (bug) (fixed)

wp_widget_categories() doesn't handle html entities in description

Reported by: guillep2k's profile guillep2k Owned by: guillep2k's profile guillep2k
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.5
Component: I18N Keywords: has-patch tested
Focuses: Cc:

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 (2)

6637.diff (516 bytes) - added by guillep2k 17 years ago.
6637-array.diff (664 bytes) - added by ryan 17 years ago.

Download all attachments as: .zip

Change History (12)

#1 @guillep2k
17 years ago

  • Cc guillep2k added
  • Component changed from General to i18n

@guillep2k
17 years ago

#2 @guillep2k
17 years ago

  • Keywords has-patch added
  • Milestone changed from 2.7 to 2.5.2

Added a patch for the proposed change.

#3 @guillep2k
17 years ago

  • Status changed from new to assigned

#4 @guillep2k
17 years ago

  • Keywords tested added

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.

@ryan
17 years ago

#5 follow-up: @ryan
17 years ago

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

#6 in reply to: ↑ 5 @guillep2k
17 years ago

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).

#7 @ryan
17 years ago

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

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

#8 @ryan
17 years ago

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

#9 @ryan
17 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

#10 @westi
17 years ago

  • Milestone changed from 2.9 to 2.6
Note: See TracTickets for help on using tickets.