Publishing Field encoding extra “?” questionmark charecters (actually acsii 8203 zero width space )
02/02/2014 Leave a comment
Assume that you have created a new article page then Typed some string in Page Content.
After Selected this content and make it bold.
Then clicked the
HTML Source.-> In html source we see following looks no unusual charecter in it .
<p><strong>sharepoint</strong></p>
But if we copy this string tsource to another program for example notepad++ We can see “?” <p><strong>sharepoint</strong>?</p> …. or if you run following powershell:
$site = get-spsite http://contoso
$web = $site.OpenWeb()
$list = $web.Lists[“Pages”]
$page = $list.GetItemById(<ItemId>)
$page[“Page Content”]
Result is same :<p><strong>sharepoint</strong>?</p>
+It is happen only when the first page created and saved.
+Issue happen when we reach data with OM or copy paste outside of the SharePoint to another advanced text editor program.
You may face this issue Both SharePoint 2010 and Sharepoint 2013
Unfortunately this is by design . The “Page Content” field or Publishing HTML Fields uses RTE (Rich text editor). RTE sometimes adds zero width space (​) as a workaround to ensure cursor range selection is correct in some browsers. When viewing “HTML Source”, browser HTML doesn’t render zero width space character. But after copying the string out,like notepad++ and powershell renders it as an unknown character (?). It is rare condition and not happen always and depends many various factors But if you have facing this
For a resolution, you may need use some custom codes for remove that charecter in related string.
String.Replace( ((char)8203).ToString(), “” );