Fast Nav URL encoder C/AL

If you need to send URL through external component such as web API or control Add-in, you may have to encode the text for ascii to ansii purpose (like replacing space by %20 and so on).

Gunnar post a code unit for that here but it’s not working with latest version of Nav, I’ve correct that.

I added a init function for batch encoding to save processing time if you call the function multiple time.

You can use the 50248 code unit provided like this :

CduURLEncoding.FctEncodeURI(Your URL Here); // Return URL encoded

This function was tested over Nav 2016, 2017 and 2018.

Codeunit 50248 Fast URL Encoder.zip

 

Leave a Reply

Your email address will not be published. Required fields are marked *