knode
#include <locale.h>
Static Public Member Functions | |
static QByteArray | defaultCharset () |
static QByteArray | defaultCharset (KNGroup::Ptr g) |
static void | encodeTo7Bit (const QByteArray &raw, const QByteArray &charset, QByteArray &result) |
static QStringList | encodings () |
static void | recodeString (const QString &s, KNGroup::Ptr g, QByteArray &result) |
static QString | toMimeCharset (const QString &charset) |
Detailed Description
A set of utilitary methods that deals with character sets.
Those methods allow:
- that only legal (as in MIME) charsets are used in headers of messages that are sent (not encoding name coming from KCharsets).
- See bug #169411, #163524 among other issues for the rational behind this class.
- or that recode 8bit strings to a hopefully proper encoding. This is used for incoming messages, specially for data from XOVER call.
Member Function Documentation
|
static |
Returns the charset defined in the global configuration.
No needs to passed it through toMimeCharset(). This must be used instead of knGlobals.settings()->charset() for out-going message.
Definition at line 76 of file locale.cpp.
|
static |
Returns the charset defined in a group configuration.
This calls defaultCharset() if no default charset is configured for this group.
Definition at line 81 of file locale.cpp.
|
static |
Convert raw data raw
to a RFC-2047 string.
- Parameters
-
raw a raw string that is assume to be encoded with charset
.charset the charset to read from raw
.result a bytearray filled with the equivalent of raw
as a RFC-2047 string orraw
if it was already correctly encoded.
Definition at line 101 of file locale.cpp.
|
static |
Returns a list of encodings along with a description.
Use KCharsets::encodingForName() to get the encodings back.
- Returns
- a list of encodings that do have valid MIME-compliant counter-parts taken out of KCharsets::availableEncodingNames().
Definition at line 120 of file locale.cpp.
|
static |
Try to convert a 8bits string to the equivalent 7bits RFC-2047 string.
- Parameters
-
s a string that contains either a properly RFC2047-encoded string, or a 8bits bytearray read as a ISO-8859-1 string. g group associated with the input string s
. used to get a charset to try the recoding.result a bytearray filled with the 7bits equivalent of s
encoded as defined in RFC-2047.
Definition at line 93 of file locale.cpp.
Converts a given charset to a charset that can be used in message headers (e.g.
in charset field of a Content-Type, or in encoding for From and Subject field). This means that this method will always returns a valid encoding as per the IANA charset list and a non empty one.
- Parameters
-
charset a charset to validate or an empty string to get a suitable default charset.
- Returns
- the equivalent of the
charset
parameter that can be used to encode MIME message or "UTF-8" if no suitable character set is found.
Definition at line 40 of file locale.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.