Reputation: 411
I have simple page that I'm using to try and test the @EncodeUrl function from the Extension Library :
<xp:panel id="encodeurl">
<xp:inputText value="#{viewScope.encodeurl}" />
<xp:br />
<xp:text value="#{javascript:var x = @EncodeUrl(viewScope.encodeurl); print( x ); return x; }"
escape="true" />
<xp:button value="submit" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="encodeurl">
</xp:eventHandler>
</xp:button>
</xp:panel>
Using the form to encode
http://127.0.0.2/BlogTesting.nsf/ExtLibURLFormulas.xsp?my_Parameter=spaces and $ymbol$
doesn't encode do as I would expect as exampled elsewhere, i.e :
http://127.0.0.2/BlogTesting.nsf/ExtLibURLFormulas.xsp?my_Parameter=spaces+and+%24ymbol%24
Rather, all I get is the same string back, both at the console and the screen. I've tried this on both a stock 9.0 installation, and 9.0.1FP7 with v17 of the extension library.
Am I missing something ?
Upvotes: 1
Views: 118
Reputation: 30970
@EncodeUrl works different than you expect. It
Adds any necessary attributes to a Domino® URL, such as a session identifier or parameters.
Use
java.net.URLEncoder.encode("your string to encode", "utf-8")
instead. It encodes the spaces and special characters in URL.
Encode only the parameters, not the entire URL. Also, don't encode parameter separator character &
nor the parameter name-value separator character =
.
Upvotes: 4