6

I'm having an issue when inserting a hyperlink of type 'http://' into the rich text editor.

I'm trying to a pass a query string value in the URL:

www.somewebsite.com/Break.aspx?ht=all&sd=31/08/2013&tp=

When inserting this in the hyperlink, Tridion is encoding the & symbol so the url returns:

www.somewebsite.com/Break.aspx?ht=all&sd=31/08/2013&tp=

This is then breaking the 'break' page further down the line as it cannot interpret the encoded query string.

Is there anyway to modify the way Tridion handles the & sign or a workaround I can use to stop this from happening?

1 Answer 1

7

In a Format Area (aka. Rich Text Editor) all content is stored as XHTML and thus it needs to be well formed. So this means that if you add this URL in the content, the & sign needs to be escaped into &. Now technically that isn't necessary for the href attribute of your link, but SDL Tridion still seems to force that on to us. Nothing you can change here for as far as I know.

However when I'm looking at my reference implementation, indeed when using a link with a query string I see the same behavior:

<a href="http://www.google.com/search?ie=UTF-8&amp;q=sdl+tridion">www.google.com/search?ie=UTF-8&amp;q=sdl+tridion</a>

This is what I see in the Source tab of my Format Area, and if this link would be left like that (tried copying it into a browser), it indeed won't be correctly interpreted by Google.

But when I look at the published result of my webpage, even though there is &amp; in my href attribute, when I click the link, it is interpreted as http://www.google.com/search?ie=UTF-8&q=sdl+tridion and works as I want. I tested this on all major browsers and do need to add that my Publication Target language is set to UTF-8 and my files are also published as true UTF-8 files and contain <meta charset="utf-8" /> in the HEAD of the HTML. So I think your problem might be solved if you make sure that your web pages are UTF-8 encoded.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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