Functions

functions to translate the contents of a buffer
[Stringbuffer, A class for manipulating strings with dynamic buffers]

Functions

void StrBufUrlescAppend (StrBuf *OutBuf, const StrBuf *In, const char *PlainIn)
 Escape a string for feeding out as a URL while appending it to a Buffer.
void StrBufHexescAppend (StrBuf *OutBuf, const StrBuf *In, const char *PlainIn)
 append a string in hex encoding to the buffer
long StrEscAppend (StrBuf *Target, const StrBuf *Source, const char *PlainIn, int nbsp, int nolinebreaks)
 Append a string, escaping characters which have meaning in HTML.
void StrMsgEscAppend (StrBuf *Target, const StrBuf *Source, const char *PlainIn)
 Append a string, escaping characters which have meaning in HTML. Converts linebreaks into blanks; escapes single quotes.
void StrIcalEscAppend (StrBuf *Target, const StrBuf *Source, const char *PlainIn)
 Append a string, escaping characters which have meaning in ICAL. [
,].
long StrECMAEscAppend (StrBuf *Target, const StrBuf *Source, const char *PlainIn)
 Append a string, escaping characters which have meaning in JavaScript strings .
long StrHtmlEcmaEscAppend (StrBuf *Target, const StrBuf *Source, const char *PlainIn, int nbsp, int nolinebreaks)
 Append a string, escaping characters which have meaning in HTML + json.
void StrBufEUid_unescapize (StrBuf *target, const StrBuf *source)
 unhide special chars hidden to the HTML escaper
void StrBufEUid_escapize (StrBuf *target, const StrBuf *source)
 hide special chars from the HTML escapers and friends
int StrBufDecodeBase64 (StrBuf *Buf)
 decode a buffer from base 64 encoding; destroys original
int StrBufDecodeHex (StrBuf *Buf)
 decode a buffer from base 64 encoding; destroys original
int StrBufSanitizeAscii (StrBuf *Buf, const char Mute)
 replace all chars >0x20 && < 0x7F with Mute
long StrBufUnescape (StrBuf *Buf, int StripBlanks)
 remove escaped strings from i.e. the url string (like 20 for blanks)
int StrBufRFC2047encode (StrBuf **target, const StrBuf *source)
 RFC2047-encode a header field if necessary. If no non-ASCII characters are found, the string will be copied verbatim without encoding.
void ctdl_iconv_open (const char *tocode, const char *fromcode, void *pic)
 Wrapper around iconv_open() Our version adds aliases for non-standard Microsoft charsets such as 'MS950', aliasing them to names like 'CP950'.
void StrBufConvert (StrBuf *ConvertBuf, StrBuf *TmpBuf, void *pic)
 convert one buffer according to the preselected iconv pointer PIC
void StrBuf_RFC822_to_Utf8 (StrBuf *Target, const StrBuf *DecodeMe, const StrBuf *DefaultCharset, StrBuf *FoundCharset)
 Handle subjects with RFC2047 encoding such as: =?koi8-r?B?78bP0s3Mxc7JxSDXz9rE1dvO2c3JINvB0sHNySDP?=.
int CompressBuffer (StrBuf *Buf)
 compress the buffer with gzip Attention! If you feed this a Const String, you must maintain the uncompressed buffer yourself!

Detailed Description

these functions translate the content of a buffer into another representation; some are combined Fillers and encoders


Function Documentation

int CompressBuffer ( StrBuf Buf  ) 

compress the buffer with gzip Attention! If you feed this a Const String, you must maintain the uncompressed buffer yourself!

Parameters:
Buf buffer whose content is to be gzipped
void ctdl_iconv_open ( const char *  tocode,
const char *  fromcode,
void *  pic 
)

Wrapper around iconv_open() Our version adds aliases for non-standard Microsoft charsets such as 'MS950', aliasing them to names like 'CP950'.

Parameters:
tocode Target encoding
fromcode Source encoding
pic anonimized pointer to iconv struct
void StrBuf_RFC822_to_Utf8 ( StrBuf Target,
const StrBuf DecodeMe,
const StrBuf DefaultCharset,
StrBuf FoundCharset 
)

Handle subjects with RFC2047 encoding such as: =?koi8-r?B?78bP0s3Mxc7JxSDXz9rE1dvO2c3JINvB0sHNySDP?=.

Parameters:
Target where to put the decoded string to
DecodeMe buffer with encoded string
DefaultCharset if we don't find one, which should we use?
FoundCharset overrides DefaultCharset if non-empty; If we find a charset inside of the string, put it here for later use where no string might be known.
void StrBufConvert ( StrBuf ConvertBuf,
StrBuf TmpBuf,
void *  pic 
)

convert one buffer according to the preselected iconv pointer PIC

Parameters:
ConvertBuf buffer we need to translate
TmpBuf To share a workbuffer over several iterations. prepare to have it filled with useless stuff afterwards.
pic Pointer to the iconv-session Object
int StrBufDecodeBase64 ( StrBuf Buf  ) 

decode a buffer from base 64 encoding; destroys original

Parameters:
Buf Buffor to transform
int StrBufDecodeHex ( StrBuf Buf  ) 

decode a buffer from base 64 encoding; destroys original

Parameters:
Buf Buffor to transform
void StrBufEUid_escapize ( StrBuf target,
const StrBuf source 
)

hide special chars from the HTML escapers and friends

Parameters:
target buffer to put the escaped string in
source buffer to escape
void StrBufEUid_unescapize ( StrBuf target,
const StrBuf source 
)

unhide special chars hidden to the HTML escaper

Parameters:
target buffer to put the unescaped string in
source buffer to unescape
void StrBufHexescAppend ( StrBuf OutBuf,
const StrBuf In,
const char *  PlainIn 
)

append a string in hex encoding to the buffer

Parameters:
OutBuf the output buffer
In Buffer to encode
PlainIn way in from plain old c strings

< we max append 3 chars at once plus the

< we max append 3 chars at once plus the

int StrBufRFC2047encode ( StrBuf **  target,
const StrBuf source 
)

RFC2047-encode a header field if necessary. If no non-ASCII characters are found, the string will be copied verbatim without encoding.

Parameters:
target Target buffer.
source Source string to be encoded.
Returns:
encoded length; -1 if non success.
int StrBufSanitizeAscii ( StrBuf Buf,
const char  Mute 
)

replace all chars >0x20 && < 0x7F with Mute

Parameters:
Mute char to put over invalid chars
Buf Buffor to transform
long StrBufUnescape ( StrBuf Buf,
int  StripBlanks 
)

remove escaped strings from i.e. the url string (like 20 for blanks)

Parameters:
Buf Buffer to translate
StripBlanks Reduce several blanks to one?
void StrBufUrlescAppend ( StrBuf OutBuf,
const StrBuf In,
const char *  PlainIn 
)

Escape a string for feeding out as a URL while appending it to a Buffer.

Parameters:
OutBuf the output buffer
In Buffer to encode
PlainIn way in from plain old c strings

< we max append 3 chars at once plus the

< we max append 3 chars at once plus the

long StrECMAEscAppend ( StrBuf Target,
const StrBuf Source,
const char *  PlainIn 
)

Append a string, escaping characters which have meaning in JavaScript strings .

Parameters:
Target target buffer
Source source buffer; set to NULL if you just have a C-String
PlainIn Plain-C string to append; set to NULL if unused
Returns:
size of result or -1
long StrEscAppend ( StrBuf Target,
const StrBuf Source,
const char *  PlainIn,
int  nbsp,
int  nolinebreaks 
)

Append a string, escaping characters which have meaning in HTML.

Parameters:
Target target buffer
Source source buffer; set to NULL if you just have a C-String
PlainIn Plain-C string to append; set to NULL if unused
nbsp If nonzero, spaces are converted to non-breaking spaces.
nolinebreaks if set to 1, linebreaks are removed from the string. if set to 2, linebreaks are replaced by &ltbr/&gt
long StrHtmlEcmaEscAppend ( StrBuf Target,
const StrBuf Source,
const char *  PlainIn,
int  nbsp,
int  nolinebreaks 
)

Append a string, escaping characters which have meaning in HTML + json.

Parameters:
Target target buffer
Source source buffer; set to NULL if you just have a C-String
PlainIn Plain-C string to append; set to NULL if unused
nbsp If nonzero, spaces are converted to non-breaking spaces.
nolinebreaks if set to 1, linebreaks are removed from the string. if set to 2, linebreaks are replaced by &ltbr/&gt
void StrIcalEscAppend ( StrBuf Target,
const StrBuf Source,
const char *  PlainIn 
)

Append a string, escaping characters which have meaning in ICAL. [
,].

Parameters:
Target target buffer
Source source buffer; set to NULL if you just have a C-String
PlainIn Plain-C string to append; set to NULL if unused
void StrMsgEscAppend ( StrBuf Target,
const StrBuf Source,
const char *  PlainIn 
)

Append a string, escaping characters which have meaning in HTML. Converts linebreaks into blanks; escapes single quotes.

Parameters:
Target target buffer
Source source buffer; set to NULL if you just have a C-String
PlainIn Plain-C string to append; set to NULL if unused
 All Classes Variables