What encoding type should I use to encode URIs?

Hello,

I have to encode a URI, and I see that the uriencode() function has the “encoding” parameter, so it can be for example “iso-8859-15” (example from syntax:functions:uriencode [EasyMorph Help]) or also “utf-8” I guess. What encoding should I use for my URLs, and what is the most common one to use? I guess it depends on the receiver’s needs, right?

What is the complete list of “encoding” types that the uriencode() function supports?

Thanks,

Roberto

For uriencode() the 1st argument is the encoding of the encoded string. In most cases, you will need to use “utf-8”.

The full list of encodings is available here: Encoding Class (System.Text) | Microsoft Docs

Under the hood uriencode uses httputility.urlencode and encode entire uri.

Also there is another function encode('uricomponentescape', value) which encodes an uri component.

1 Like