By Anonymous (not verified) on
My website has an ampersand in the title (Digital Arts & Humanities). It is of course no problem to simply enter that into Drupal, but then the W3C validator complains about it not being proper XHTML ("You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe."). However, if I enter the correct & then websites like Technorati list that as the name of the site (i.e. Digital Arts & Humanities) - and the same happens to RSS feeds etc.
Is there a way around it?
Comments
Try unicoding it...
Have you tried Unicode? & is
&# 38;João Ventura
Venturas.org
Unicode not working
Sorry for the delay, Drupal failed to send me a notification of your reply!
Unfortunately, the Unicode suggestion does neither lead to valid XHTML code (with charset UTF-8) nor to the Ampersand being displayed properly.
I'm having the same problem.
I'm having the same problem. It only seems to occur in the title tag in the header. All other occurrences of
&are converted to&properly.I changed the theme page.tpl.php line 5(using a modified garland theme)
changed to
That seems to work, website validates correctly and the browser shows
&as ist should. RSS feeds look OK as well.What I did above only worked
What I did above only worked until I created a node with a & in the title :(
On a plain drupal instalation with site name 'A & B' and a node with title 'C & D' the source shows
in the title tag of the header.
The & in the node title is converted and the site name & is not.
$head_title is made in phptemplate.engine:
changing that to:
I know I shouldnt be messing with core, but is there another way?
The problem with simply
The problem with simply putting the correct XHTML code for the ampersand into the "Name" field of Drupal's "Site information" actually goes beyond RSS feeds. If you enter
& a m p ;in that field, all the automated emails etc. that Drupal sends show& a m p ; in their subject lines or bodies.So what would be needed is Drupal handling the conversion properly when it is needed (i.e. for creating valid (X)HTML), and otherwise not changing anything...
Bug report
I created a bug report related to this: http://drupal.org/node/535240 so hopefully something can be done at the core level