GMime.Charset¶
Fields¶
Name  | 
Type  | 
Access  | 
Description  | 
|---|---|---|---|
level  | 
r/w  | 
charset level  | 
|
mask  | 
r/w  | 
charset mask  | 
Methods¶
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
Details¶
- class GMime.Charset¶
 State used by
GMime.Charset.best() andGMime.Charset.best_name().- classmethod best(inbuf, inlen)¶
 - Parameters:
 - Returns:
 the charset name best suited for the input text or
Noneif it is ascii-safe.- Return type:
 
Computes the best charset to use to encode this text buffer.
- classmethod canon_name(charset)¶
 - Parameters:
 charset (
str) – charset name- Returns:
 a canonical charset name for charset.
- Return type:
 
Attempts to find a canonical charset name for charset.
Note: Will normally return the same value as
GMime.Charset.iconv_name() unless the system iconv does not use the canonical ISO charset names (such as using ISO8859-1 rather than the canonical form ISO-8859-1).
- classmethod iconv_name(charset)¶
 - Parameters:
 charset (
str) – charset name- Returns:
 an iconv-friendly charset name for charset.
- Return type:
 
Attempts to find an iconv-friendly charset name for charset.
- classmethod iso_to_windows(isocharset)¶
 - Parameters:
 isocharset (
str) – ISO-8859-# charset- Returns:
 equivalent Windows charset.
- Return type:
 
Maps the ISO-8859-# charset to the equivalent Windows-CP125# charset.
- classmethod language(charset)¶
 - Parameters:
 charset (
str) – charset name- Returns:
 a language code that is specific to charset, or
Noneon fail.- Return type:
 
Attempts to find a specific language code that is specific to charset. Currently only handles CJK and Russian/Ukranian charset->lang mapping. Everything else will return
None.
- classmethod locale_name()¶
 - Returns:
 the user’s locale charset (or iso-8859-1 by default).
- Return type:
 
Gets the user’s locale charset (or iso-8859-1 by default).
Note: This function is deprecated. Use
GMime.locale_charset() instead.
- classmethod map_init()¶
 Initializes character set maps.
Note:
GMime.init() calls this routine for you.
- classmethod map_shutdown()¶
 Frees internal lookup tables created in
GMime.Charset.map_init().
- classmethod name(charset)¶
 - Parameters:
 charset (
str) – charset name- Returns:
 an iconv-friendly charset name for charset.
- Return type:
 
Attempts to find an iconv-friendly charset name for charset.
Note: This function is deprecated. Use
GMime.Charset.iconv_name() instead.
- best_name()¶
 - Returns:
 the charset name that best represents the charset mask self or
Nonefor us-ascii.- Return type:
 
Gets the best charset name based on the charset mask self.
- can_encode(charset, text, len)¶
 - Parameters:
 - Returns:
 Trueif it is safe to encode text into charset orFalseotherwise.- Return type:
 
Check to see if the UTF-8 text will fit safely within charset.
- init()¶
 Initializes a charset mask structure.
- step(inbuf, inlen)¶
 - 
Steps through the input buffer 1 unicode character (glyph) at a time (ie, not necessarily 1 byte at a time). Bitwise ‘and’ our self->mask with the mask for each glyph. This has the effect of limiting what charsets our self->mask can match.