Skip to content

Instantly share code, notes, and snippets.

@hishnash
Created April 4, 2017 15:35
Show Gist options
  • Save hishnash/c231d865cf82da64c8e4b333c97bd467 to your computer and use it in GitHub Desktop.
Save hishnash/c231d865cf82da64c8e4b333c97bd467 to your computer and use it in GitHub Desktop.
.. dv:: URL Encoding
    :keywords: url-encoding

    .. dvvis:: Visual

        .. figure:: /Images/encoding_crypto/URLEncodingDynamicValue.png

            A `Percent-encoding <http://en.wikipedia.org/wiki/Percent-encoding>`_ converter conforming to `RFC3986 <http://tools.ietf.org/html/rfc3986>`_.

    .. dvspec:: Code
        :identifier: com.luckymarmot.URLEncodingDynamicValue

        .. arg:: input
            :type: DynamicString

            Text input to be encoded/decoded.

        .. arg:: charset
            :type: string
            :default: ``utf-8``

            Charset to be used.

        .. arg:: mode
            :type: number
            :default: ``0`` (Encode)

            Operation mode (0: Encode, 1: Decode).

        .. code-block:: javascript

            function evaluate(context){
                var dv = new DynamicValue('com.luckymarmot.URLEncodingDynamicValue', {
                    'input': 'Something to be URL-encoded'
                });
                return dv.getEvaluatedString();
            };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment