GMimeFilterBest

GMimeFilterBest — Determine the best charset/encoding to use for a stream

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GMimeFilter
        ╰── GMimeFilterBest

Description

A GMimeFilter which is meant to determine the best charset and/or transfer encoding suitable for the stream which is filtered through it.

Functions

g_mime_filter_best_new ()

GMimeFilter *
g_mime_filter_best_new (GMimeFilterBestFlags flags);

Creates a new GMimeFilterBest filter. flags are used to determine which information to keep statistics of. If the GMIME_FILTER_BEST_CHARSET bit is set, the filter will be able to compute the best charset for encoding the stream of data filtered. If the GMIME_FILTER_BEST_ENCODING bit is set, the filter will be able to compute the best Content-Transfer-Encoding for use with the stream being filtered.

Note: In order for the g_mime_filter_best_charset() function to work, the stream being filtered MUST already be encoded in UTF-8.

Parameters

flags

filter flags

 

Returns

a new best filter with flags flags .


g_mime_filter_best_charset ()

const char *
g_mime_filter_best_charset (GMimeFilterBest *best);

Calculates the best charset for encoding the stream filtered through the best filter.

Parameters

best

best filter

 

Returns

a pointer to a string containing the name of the charset best suited for the text filtered through best .


g_mime_filter_best_encoding ()

GMimeContentEncoding
g_mime_filter_best_encoding (GMimeFilterBest *best,
                             GMimeBestEncoding required);

Calculates the best Content-Transfer-Encoding for the stream filtered through best that fits within the required encoding.

Parameters

best

best filter

 

required

encoding that all data must fit within

 

Returns

the best encoding for the stream filtered by best .

Types and Values

struct GMimeFilterBest

struct GMimeFilterBest;

A filter for calculating the best encoding and/or charset to encode the data passed through it.

Members


enum GMimeBestEncoding

Used with g_mime_filter_best_encoding() as the 'required' argument. These values provide a means of letting the filter know what the encoding requirements are for the stream.

Members

GMIME_BEST_ENCODING_7BIT

The stream data must fit within the 7bit ASCII range.

 

GMIME_BEST_ENCODING_8BIT

The stream data may have bytes with the high bit set, but no null bytes.

 

GMIME_BEST_ENCODING_BINARY

The stream may contain any binary data.

 

enum GMimeFilterBestFlags

Bit flags to enable charset and/or encoding scanning to make educated guesses as to what the best charset and/or encodings to use for the content passed through the filter.

Members

GMIME_FILTER_BEST_CHARSET

Enable best-charset detection.

 

GMIME_FILTER_BEST_ENCODING

Enable best-encoding detection.

 

See Also

GMimeFilter