#include <TransferEncoding.h>
|
static ByteString | encode (const ByteString &_str) |
Definition at line 24 of file TransferEncoding.h.
◆ encode()
ByteString QuotedPrintableEncoder::encode |
( |
const ByteString & | _str | ) |
|
|
static |
Definition at line 32 of file TransferEncoding.cpp.
33{
35
36 static const char aHex[] = "0123456789ABCDEF";
38 size_t len = _str.length();
39
40 ByteBuffer*
buf = ByteBuffer::create(
43 int lineCount = 0;
45 {
47 if ((c ==
CR) && (*src ==
LF) &&
len)
48 {
49
51 *dest++ = *src++;
53 lineCount = 0;
54 }
55 else
56 {
57 if (
58
59 (c <= 0x1f)
60 || (c == 0x7f)
61 || (c & 0x80)
62 || (c == '=')
63 || ((c ==
' ') && (*src ==
CR)))
64 {
65
67 {
68
69 *dest++ = '=';
72 lineCount = 0;
73 }
74
75 *dest++ = '=';
76 *dest++ = aHex[c >> 4];
77 *dest++ = aHex[c & 0x0f];
78 lineCount += 3;
79 }
80 else
81 {
82
84 {
85
86 *dest++ = '=';
89 lineCount = 0;
90 }
91
92 *dest++ = c;
93 lineCount++;
94 }
95 }
96 }
99 buf->__dataLength = (
char*) dest -
buf->data();
101
105}
#define __DCL_ASSERT(expr)
The documentation for this class was generated from the following files: