Publishing Field encoding extra “?” questionmark charecters (actually acsii 8203 zero width space )


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.

Similar :http://social.msdn.microsoft.com/Forums/sharepoint/en-US/23804eed-8f00-4b07-bc63-7662311a35a4/why-does-sharepoint-put-in-character-code-8203-in-a-richtext-field?forum=sharepointdevelopment

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 (&#8203) 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(), “” );

Advertisements

About bpostaci
Escalation Engineer in Microsoft.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: