import urllib.parse


def url_encode(src_str):
    """
    It returns the URL UTF-8 encoded value of the given string.
    A string with null value is considered as an empty string.
    """
    if not src_str:
        return ""

    return urllib.parse.quote(src_str, encoding="UTF-8")