Download & Extend

Editor removes space before and after ampersand

Project:YUI Rich Text Editor
Version:6.x-2.33
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi,

When an ampsersand (&) is entered in to the YUI editor, the editor strips out spaces before and after the character when it is published.

For example: 'Visitors & Events' becomes 'Visitors&Events'

Im sure this should be a quick fix...but its a pretty annoying issue, as it causes the pages with ampersands not to validate.

Please help
Thanks
Rich

Comments

#1

+1 for this, though I'm not sure if it's a problem with the Module or a problem with the YUI code which the module maintainer wouldn't be able to control.

#2

+1 subscribe

#3

Looks like Dav Glass has fixed this in the 2.7.0 YUI Library:
http://yuilibrary.com/forum/viewtopic.php?p=754

Now, how do we upgrade from 2.5.0 to 2.7.0 here in Drupal?

Apparently, we are stuck with 2.5.0 and cannot upgrade?
http://drupal.org/node/316984

#4

A quick fix is to add the following to your theme's template.php:

function THEMENAME_preprocess_node(&$variables) {
    $variables['content'] = str_replace('&',' & ', $variables['content']);
}

Or if your template.php already as THEMENAME_preprocess_node declared, just add the 2nd line of code above to it, making sure that you replace "$variables" with the name of the function's parameter (it's sometimes $vars instead).

This won't really fix the root of the issue (i.e., the content in the database will still have the spaces stripped), but it will ensure that spaces are added to the ampersand when the node is being displayed.

nobody click here