• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

knode

  • KNode
  • Utilities
  • Locale
Static Public Member Functions | List of all members
KNode::Utilities::Locale Class Reference

#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.

Definition at line 53 of file locale.h.

Member Function Documentation

QByteArray Locale::defaultCharset ( )
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.

QByteArray Locale::defaultCharset ( KNGroup::Ptr  g)
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.

void Locale::encodeTo7Bit ( const QByteArray &  raw,
const QByteArray &  charset,
QByteArray &  result 
)
static

Convert raw data raw to a RFC-2047 string.

Parameters
rawa raw string that is assume to be encoded with charset.
charsetthe charset to read from raw.
resulta bytearray filled with the equivalent of raw as a RFC-2047 string or raw if it was already correctly encoded.

Definition at line 101 of file locale.cpp.

QStringList Locale::encodings ( )
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.

void Locale::recodeString ( const QString &  s,
KNGroup::Ptr  g,
QByteArray &  result 
)
static

Try to convert a 8bits string to the equivalent 7bits RFC-2047 string.

Parameters
sa string that contains either a properly RFC2047-encoded string, or a 8bits bytearray read as a ISO-8859-1 string.
ggroup associated with the input string s. used to get a charset to try the recoding.
resulta bytearray filled with the 7bits equivalent of s encoded as defined in RFC-2047.

Definition at line 93 of file locale.cpp.

QString Locale::toMimeCharset ( const QString &  charset)
static

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
charseta 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:
  • locale.h
  • locale.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:37 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

knode

Skip menu "knode"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal