WordPress.org

Make WordPress Core

#22909 closed defect (bug) (worksforme)

Special characters are not displayed properly on the menus

Reported by: varna_city Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Menus Keywords: reporter-feedback
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The previous version of Wordpress 3.4 did handle special characters like ★ and ✄ pretty well. Wordpress 3.4 displays such special characters and they can be used on the Wordpress menus, however in version 3.5, these characters are displayed as empty squares, which does mean that 3.5 can't recognize them properly.

Attachments (1)

special-char-menu.zip (820 bytes) - added by toscho 16 months ago.
Test plugin with non-ASCII characters in menu titles

Download all attachments as: .zip

Change History (13)

comment:1 toscho16 months ago

Empty squares are usually an indicator for a browser issue: your browser cannot find a font on your operating system to render these characters. Check your font list and try another browser.

comment:2 toscho16 months ago

  • Cc info@… added

comment:3 varna_city16 months ago

Hi, I've tested it with different browsers, the problem is the Wordpress system. When I downgraded to Wordpress 3.4 everything is fine again. I think that Wordpress 3.5 is just using a wrong encoding for the menus in contrast to Wordpress 3.4.

Last edited 16 months ago by varna_city (previous) (diff)

comment:4 SergeyBiryukov16 months ago

  • Keywords reporter-feedback added

Could you provide some steps to reproduce the issue?

I've tried adding "★ and ✄" to a menu name and to individual menu item labels, and they still display correctly in 3.5. Tested in Firefox 17.

comment:5 SergeyBiryukov16 months ago

Also, which browser and OS?

comment:6 varna_city16 months ago

I did try to do it on another site and the same issue is present. OS tested: Windows 7 and Windows 8. Browsers: IE9, IE10, Firefox 17.0.1, Opera latest stable, Chrome latest stable, Safari for Windows 5.1.7. A friend of mine with Windows 7 and Firefox 17.0 did open the two sites and got the same issue. Wordress 3.4 is working fine, 3.5 - had a bug into the menus.

comment:7 SergeyBiryukov16 months ago

Steps to reproduce?

toscho16 months ago

Test plugin with non-ASCII characters in menu titles

comment:8 toscho16 months ago

  • Keywords needs-patch removed

My guess: Your plugin is not properly encoded or your OS is lacking the fonts with these characters. The plugin has to be UTF-8 without a BOM. See attached test plugin. Tested in two installations, Win 7 and Cent OS.

Code:

<?php
/**
 * Plugin Name: Test Non-ASCII Characters In Menus
 * Plugin URI:  http://core.trac.wordpress.org/ticket/22909
 *
 * This file is encoded in UTF-8 without BOM. Do not change that.
 */

add_action( 'admin_menu', 'tnacim_add_menu' );

/**
 * Register menu with a funny title.
 *
 * @wp-hook admin_menu
 * @return  void
 */
function tnacim_add_menu()
{
	add_menu_page(
		'✂ ✉ ✔✽ ✾ ✿ ❀ ❉ ❤',
		'❦ ☂ ☔ ☎ ☘ ♫ ♻ ⚥',
		'edit_posts',
		'tnacim',
		'tnacim_callback'
	);

	add_submenu_page(
		'tnacim',
		'⁂‖‣‗•⁁※‼‽℡№℠↹↯',
		'☠☢☣☮☯☹✂✍✎',
		'edit_posts',
		'tnacim-sub',
		'tnacim_callback'
	);
}
/**
 * Print menu pages.
 *
 * @return void
 */
function tnacim_callback() {

	$glob = array ();
	foreach ( $GLOBALS as $k => $v )
		is_scalar( $v ) and $glob[ $k ] = $v;

	ksort( $glob );

	print '<h1>' . $GLOBALS['title'] . '</h1>';

	print '<pre>'
		. htmlspecialchars(
			print_r( $glob, TRUE ), ENT_QUOTES, 'utf-8', FALSE
		)
		. '</pre>';
}

comment:9 DrewAPicture16 months ago

  • Summary changed from Special charters are not displayed properly on the menus to Special characters are not displayed properly on the menus

comment:10 SergeyBiryukov16 months ago

  • Severity changed from critical to normal

comment:11 SergeyBiryukov16 months ago

  • Description modified (diff)

comment:12 SergeyBiryukov10 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Feel free to reopen with the steps to reproduce on a clean install if there's still a problem.

Note: See TracTickets for help on using tickets.