Without patching PHPTemplate, I can't seem to get a site name like "Rest & Relaxation" to work right (at least using Garland). If I use '&', the site's name and the tooltips work right, but the page's title (as seen in the HTML header) does not have the & interpreted correctly. If I use '&' as the site name, the page's title is good, but the rest of the page has the &'s turned into &'s.

I'm new to hacking Drupal, but I think I've made a suitable patch. Works for me at least. ;)

Comments

Steven’s picture

Status: Needs review » Needs work

Right. The <head> title cannot contain HTML, but must be escaped properly. The name and slogan are plain-text and should be output as such. We already do this for RSS feeds.

However, chameleon should be updated as well.

cliff_dugal’s picture

Version: 5.0 » 6.1
StatusFileSize
new1.5 KB

I suppose I might as well mention that this problem still occurs in Drupal 6.1. And, I might as well also include my patch that works for me.

johnalbin’s picture

Version: 6.1 » 6.x-dev
Status: Needs work » Needs review
StatusFileSize
new2.68 KB
new2.68 KB

Confirmed that the head title doesn’t get any html entity encoding.

Here’s the patches that include Chameleon.

johnalbin’s picture

Version: 6.x-dev » 7.x-dev

To get some eyeballs.

c960657’s picture

Status: Needs review » Needs work

With this patch, node titles get double-encoded. E.g. if I create a new content node with the title "Me & you", the page title reads "Me & you | Mysite".

The string returned by drupal_get_title() is an HTML encoded string. The node title is check_plain'ed in node_page_view() before being set with drupal_set_title().

I suggest you update the documentation for drupal_get_title() and drupal_set_title() to mention that the title is HTML encoded text.

c960657’s picture

Status: Needs work » Closed (duplicate)

More or less a duplicate of #242873: make drupal_set_title() use check_plain() by default. that has a patch as well as a test case.