DCL 4.0
Loading...
Searching...
No Matches
URLEncoder Class Reference

#include <URI.h>

Static Public Member Functions

static ByteString encode (const ByteString &_str)
static String encode (const String &_str)

Detailed Description

Definition at line 26 of file URI.h.

Member Function Documentation

◆ encode() [1/2]

ByteString URLEncoder::encode ( const ByteString & _str)
static

Definition at line 83 of file URI.cpp.

84{
85 static unsigned char hexchars[] = "0123456789ABCDEF";
86
87 ByteStringBuilder r;
88
89 const char* psz = _str.data();
90 for (; *psz; psz++)
91 {
92 unsigned char c = (unsigned char)*psz;
93 if (c == ' ')
94 r += '+';
95 else if ((c < '0' && c != '-' && c != '.')
96 || (c < 'A' && c > '9')
97 || (c > 'Z' && c < 'a' && c != '_')
98 || (c > 'z'))
99 {
100 r += '%';
101 r += (char)hexchars[c >> 4];
102 r += (char)hexchars[c & 15];
103 }
104 else
105 r += (char)c;
106 }
107 return r;
108}
ByteString r

◆ encode() [2/2]

String URLEncoder::encode ( const String & _str)
static

Definition at line 110 of file URI.cpp.

111{
114 UTF8Encoder::encode(_str)
115 )
116 );
117}
static String decode(const char *_mbs, size_t _mbslen=(size_t) -1)
static ByteString encode(const ByteString &_str)
Definition URI.cpp:83

The documentation for this class was generated from the following files: