In our world we have a lot of languages and character sets. For that reason we often use UTF-8 encoding. The user will not be aware which encoding is currently in use when writing text in Notepad or other editors.

Save As dialog in Notepad:

image

 

How would a URL and/or URI be presented?

http://ServerName/Docs/Documents/RU ва document.docx

or

http://ServerName/Docs/Documents/RU%20%D0%B2%D0%B0%20document.docx

Both URL’s might work and it depends on the Web-Browser and Web-Server whether it works. The RFC’s are telling us that the second one is the right one. That means the first one could work and the second one should work. On the Internet we have enough discussions and ideas so this post should not start another one.

Now the problem I would talk about.

In our Computer World we have also File-Servers and a created link shows in a Web-Browser:

file://ServerName/Folder/FileName.ext

This Link must only work on the client machine and the Web-Browser is responsible for interpreting this kind of Link. I started with arguments that there are a lot of languages and character sets outside and therefore the language and character settings on client machines will vary a lot.

You entered a Link to a document living on a File-Server in the Summary Link Web Part:

file://ServerName/russian/ва document.txt

And the result when you look into the HTML source is:

file://ServerName/russian/%D0%B2%D0%B0%20document.txt

The Web-Browser shows you (could vary and depends on the Browser and all other settings):

file://ServerName/russian/ва document.txt

It looks like a problem in the Web-Browser because the application understands each “%D0” as one Character in the current configured language and character set of the client machine.

The Web-Server did the work well because it observers RFC conformity. When we analyze all possible Links we can use inside a SharePoint web-page it seems to be possible with an UTF-8 coded HTML page also seeing HREFs with UTF-8 encoded. Use “Links List” inside a Team-Site as one example.

Our Summary Links Web Part based on XML and XSLT so for the rendering we are using code to transform the XML output with the XSLT templates.

The XML output is UTF-8 coded and with the responsible line in the ItemStyle.xsl the HREF looks RFC conform:

<a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}">

Anything works perfect and what I can do to get also my entered links in a usable way when browsing the homepage of my SharePoint Publishing “Portal” with the Summary Link Web Part?

With the next steps I want to explain a way to workaround all these circumstances.

  • You must do this on each Web-Front-End Server (WFE)
  • Navigate to \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\PublishingResources
  • Create a copy of the ItemStyle.xsl
  • Edit the original file e.g. with Notepad
  • Find the first occurrence and remove the lines I have formatted strike-through

<div class="link-item">
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>
<
a href="{$SafeLinkUrl}" target="{$LinkTarget}" title="{@LinkToolTip}">
<
xsl:value-of select="$DisplayTitle"/>
</a>
<div class=
"description">
<xsl:value-of select="@Description" />
</div>
</div>

  • Insert these lines where you removed the above ones:

<xsl:text disable-output-escaping="yes">&lt;a href=&quot; </xsl:text>
<xsl:value-of disable-output-escaping="no" select="$SafeLinkUrl"/>
<xsl:text disable-output-escaping="yes">&quot; target=&quot;</xsl:text>
<xsl:value-of disable-output-escaping="no" select="$LinkTarget"/>
<xsl:text disable-output-escaping="yes">&quot; title=&quot;</xsl:text>
<xsl:value-of disable-output-escaping="no" select="@LinkToolTip"/>
<xsl:text disable-output-escaping="yes">&quot;&gt;</xsl:text>
<xsl:value-of disable-output-escaping="no" select="$DisplayTitle"/>
<xsl:text disable-output-escaping="yes">&lt;/a&gt;</xsl:text>

  • Run an IISRESET
  • Try it out
  • The side-effect I see in my test environment is that http links are also encoded in UTF-8. It depends on the IE settings whether the browser is able to use UTF-8 encoded http links or not.

Please be very careful when you edit such files because results can be vary because this is customization. I cannot give any guarantee so please test it before you go into the production!

References:

How to: Customize Styles: http://msdn.microsoft.com/en-us/library/ms551040.aspx

How to: Customize XSL for the Content Query Web Part: http://msdn.microsoft.com/en-us/library/bb447557.aspx

RFC’s: http://www.w3.org/TR/html401/references.html