Every time I have a menu title with the ' (apostrophe) character in it, the character is replaced by the string &#039 ;

CommentFileSizeAuthor
#2 menu_breadcrumb.patch880 bytesgorbeia
menuProblem.jpg47.22 KBstefan_pn

Comments

gorbeia’s picture

This happens because you have set the title to be a link to the content.
In the menu_breadcrumb_init() the drupal_get_title() executes check_plain to the title which converts especial characters to html entities. Then the l function calls check_plain again converting the '&' character to the '&' entity. The l function should be passed a third argument stating that the link content is already clean html content as you can read in the l function documentation.

gorbeia’s picture

Status: Active » Needs review
StatusFileSize
new880 bytes

Patch attached

stefan_pn’s picture

Thanks for support
I cant tell if the patch is working, i'll try it on a test site.

wflorian’s picture

I am using a theme hack to display the title of the actual node in the breadcrumbs. This does work, but I also have to face the same problem as above. Every "&" is a "&" instead. I am using the following code:

function YOURTHEME_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    $breadcrumb[] = l(drupal_get_title(), $_GET['q']);
    return '<div class="breadcrumb">'. implode(' &raquo; ', $breadcrumb) .'</div>';
  }
}

Your patch did not work for me.

-      $breadcrumb[] = l(drupal_get_title(), $_GET['q']);
+      $breadcrumb[] = l(drupal_get_title(), $_GET['q'], array('html' => TRUE,));

Is it because I am using D5? The API Code for D5 looks different. Any idea what I can do to solve this problem?

Thank you!

justageek’s picture

Yes, if you look at api.drupal.org/api/function/l/5 you will see the parameter list is completely different, so the patch will not work for D5

I had already hacked this in and it does work for D6

floown’s picture

The bug is still present on 6.x-1.x-dev

floown’s picture

julien verkest’s picture

function volterev_breadcrumb($breadcrumb) {
	if (!empty($breadcrumb)) {
		$breadcrumb = str_replace('&amp;#039;','\'',$breadcrumb);
		return '<div class="breadcrumb">'. implode(' » ',$breadcrumb) .'</div>';		 
		
	}
}

It works for me.

les lim’s picture

Title: Caracters &#039 in a Menu Breadcrumb title instead of ' (apostrophe) » Double-escaped strings causing improper output of special characters
Status: Needs review » Reviewed & tested by the community

The patch in #2 is the proper fix. It's a trivial enough fix to go RTBC, in my opinion.

xurizaemon’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gaëlg’s picture