SharePoint 2013 : The search results with %5C (the “” character) will become double encoded and causes broken links

 

Use Case Description: The search results with %5C (the “\” character) will become double encoded (represented as “%255C″). This causes broken links for e.g. when accessing Search Center and performing people search with "user1". At the peopleresults.aspx page, click the username in the search result

Actual Results: The personal site of user1 cannot be accessed. You can see the personal site for user1 is something like below

http://sp2013.contoso.com/my2/Person.aspx?accountname=contoso%255Cuser1

 

Workaround Instructions: Apply below workaround on current search center site. If you have additional search center sites, please update all of them.

1. On your Search Center site collection go to Site Settings and then Master Page Gallery

2. On Master Page Gallery click on Display Templates and then click on Search

Now find File named Item_Person.html and then checkout the file. Make a backup of the file and open the file in your favorite text editor and locate highlighted Line in below Screenshot.

 

image

3. Now replace above highlighted line replace with following text.

var encodedPath = $urlHtmlEncode(decodeURI(ctx.CurrentItem.Path));

4. Now find File named Item_Person_CompactHorizontal.html and then checkout the file. Make a backup of the file and open the file in your favorite text editor and then locate highlighted Line in below Screenshot.

image

 

5. Now replace above highlighted line replace with following text.

              var pathEncoded = $urlHtmlEncode(decodeURI(ctx.CurrentItem.Path));

 

6. Now find File named Item_Person_HoverPanel.html and then checkout the file. Make a backup of the file and open the file in your favorite text editor and then locate highlighted Line in below Screenshot.

 

image

Now replace above highlighted line so that it looks like following.

<a id="_#= visitId =#_" class="ms-calloutLink ms-uppercase" href="_#= $urlHtmlEncode(decodeURI(ctx.CurrentItem.Path)) =#_" title="_#= $htmlEncode(Srch.Res.hp_PeopleItem_ViewProfile) =#_">

7. Now check-in the above files and make sure they are published.

Note:  This issue is now fixed as described in http://support.microsoft.com/kb/2883088 , Which is included in Sep 2014 CU for SharePoint 2013

 

POST BY: Srinivas Dutta [MSFT]