ot::net
class URLEncoder
#include "ot/net/URLEncoder.h"
A class module containing static methods for encoding strings into a form that can be transmitted as a URL.
Encode
static String Encode(const String& s)
-
Converts a Unicode string into the MIME x-www-form-urlencoded format.
To convert a String, each Unicode character is examined in turn:
-
The ASCII characters 'a' through 'z', 'A' through 'Z', '0' through '9', and ".", "-", "*", "_" remain the same.
-
The space character ' '(U+20) is converted into a plus sign '+'.
-
All other characters are converted into their UTF-8 equivalent and the subsequent bytes are encoded as the 3-byte string "%HH", where HH is the two-digit hexadecimal representation of the byte.
EncodeBytes
static ByteString EncodeBytes(const ByteString& in)
-
Encodes a sequence of Bytes into the MIME x-www-form-urlencoded format, which is described in the HTML 4.0 Recommendation.
Each byte in the passed sequence is examined and added to the returned ByteString after going through the following transformation:-
-
The ASCII characters 'a' through 'z', 'A' through 'Z', '0' through '9', and ".", "-", "*", "_" remain the same.
-
The space character ' '(U+20) is converted into a plus sign '+'.
-
All other characters are encoded as the 3-byte string "HH", where HH is the two-digit hexadecimal representation of the byte.
- Returns:
-
A ByteString containing the encoded bytes.
- Since:
-
OpenTop 1.5
RawEncode
static String RawEncode(const String& s)
-
Converts a Unicode string into an escaped form.
This method performs a similar function to Encode(), but the algorithm has been modified to ignore certain escape characters thereby making it idempotent.
The algorithm employed is described in the W3C XML recommendation section 4.2.2, External Entities.
Found a bug or missing feature? Please email us at support@elcel.com