module URLEncoding

Extended Modules

Defined in:

urlencoding.cr

Constant Summary

VERSION = "1.0.0"

Instance Method Summary

Instance Method Detail

def decode(data) #

Decode percent-encoded string assuming UTF-8 encoding.

Example:

res = URLEncoding.decode("%F0%9F%91%BE%20Exterminate%21") puts res

@param data @return decoded string


[View source]
def decode_binary(data) #

Decode percent-encoded string as binary data, in any encoding.

Example:

res = URLEncoding.decodeBinary("%F1%F2%F3%C0%C1%C2") puts res

@param data @return decoded string


[View source]
def encode(data) #

Percent-encodes every byte except alphanumerics and -, _, ., ~. Assumes UTF-8 encoding.

Example:

res = URLEncoding.encode("This string will be URL encoded.") puts res

@param data @return encoded string


[View source]
def encode_binary(data) #

Percent-encodes every byte except alphanumerics and -, _, ., ~.

Example:

res = URLEncoding.encodeBinary("This string will be URL encoded.") puts res

@param data @return encoded string


[View source]