replacing special chars in url


we've got a program which is called mega plus. This software is basically web based but it doesn'T use normal http protocol. Instead, it seperates parameters using the pipe | (%7c).

Sadly, this disturbs confluence. Links to megaplus don't work unless I manually repeace those pipes with %7c.

Is there any way to do this automatically?

3 answers

That is because the pipe character ('|') is not allowed in URLs. That is why it needs to be encoded. You can read more in the standard RFC 1738.

I am afraid there is not an easy way to replace those character automatically. There is already a feature request for this in

Some ugly user macro to the rescue smile

## @param Url:title=Url|type=string|required=true|desc=Server name (with protocol)
## @param Query:title=Query|type=string|required=true|desc=Query (to encode)
#set ($urlEncoderClass=$content.class.forName(''))
#set ($stringClass=$content.class.forName('java.lang.String'))
#set ($getInstanceMethod=$urlEncoderClass.getDeclaredMethod('encode', $stringClass))
#set ($encoded=$getInstanceMethod.invoke(null, $paramQuery))
<a href="$paramUrl${encoded}">$paramUrl$paramQuery</a>

Basically, in your case you can hardcode the paramUrl parameter to make it easier to put such links (only the query string to enter, which will be encoded properly in a link, but will look as-is in link's caption)


that'll help thank you laugh

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Monday in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

58 views 3 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you