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
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

950 views 2 13
Read article

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