Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a page in SharePoint 2010 and in the Title field it reads 'Faculty & Staff'. However, when I view the page in the browser it displays 'Faculty %26Staff'. I have tried different ways to escape the ampersand including using the HTML code for it and adding a second ampersand next to it. Nothing seems to work. Does anyone know how to escape it in the title? Thank you, David!

share|improve this question
    
It is not a solution, but this is a list of forbidden characters in titles(and more) including your &-sign: support.microsoft.com/default.aspx?scid=kb;en-us;905231 –  Niels Aug 16 '12 at 22:25
add comment

2 Answers

It looks like this is a bug that was fixed in an post-RTM update. So the real solution would be to install Service Pack 1 (or later, if available).

I stumbled upon this issue on a client's farm. They weren't yet ready to install the Service Pack and the 'EncodeTitle' solution didn't work for me. So I fixed it by including the following piece of Javascript (also using jQuery).

Warning: It's a specific fix for a specific encoding issue they experienced. You may have to adapt the search pattern and replacement string to your specific situation.

<script type="text/javascript" src="/...somescriptsdoclib.../jquery-1.8.2.min.js"></script>
<script type="text/javascript">

    jQuery(document).ready(function () {

        fixSiteTitleBug();

    });

    function fixSiteTitleBug()
    {
        var searchPattern = /&amp;#39;/gm;
        var replacement = '\'';

        // Fix Quick Launch items
        var html = jQuery('#s4-leftpanel-content').html().replace(searchPattern, replacement);
        jQuery('#s4-leftpanel-content').html(html);

        // Fix breadcrumb items
        jQuery('a.breadcrumbNode').each(function () {
            jQuery(this).html(jQuery(this).html().replace(searchPattern, replacement));
        });

        jQuery('a.breadcrumbRootNode').each(function () {
            jQuery(this).html(jQuery(this).html().replace(searchPattern, replacement));
        });
    }

</script>
share|improve this answer
add comment
up vote 3 down vote accepted

I actually found the answer here: http://onlinecoder.blogspot.com/2012/05/special-characters-in-sharepoint-top.html You need to find the following block of code in your masterpage:

<SharePoint:AspMenu
    ID="TopNavigationMenuV4"
    Runat="server"
    EnableViewState="false"
    DataSourceID="topSiteMap"
    AccessKey="<%$Resources:wss,navigation_accesskey%>"
    UseSimpleRendering="true"
    UseSeparateCss="false"
    Orientation="Horizontal"
    StaticDisplayLevels="1"
    MaximumDynamicDisplayLevels="1"
    SkipLinkText=""
    CssClass="s4-tn"/>

and add EncodeTitle="false" after SkipLinkText="" Save and Publish your file.

share|improve this answer
    
David - please mark this as accepted answer if it is the solution. You can also vote up other helpful answers. –  SPDoctor Aug 19 '12 at 9:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.