\section{KCharsets Class Reference}
\label{classKCharsets}\index{KCharsets@{KCharsets}}
Charset font and encoder/decoder handling.  


{\tt \#include $<$kcharsets.h$>$}

\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual {\bf $\sim$KCharsets} ()
\item 
{\bf QText\-Codec} $\ast$ {\bf codec\-For\-Name} (const {\bf QString} \&name) const 
\item 
{\bf QText\-Codec} $\ast$ {\bf codec\-For\-Name} (const {\bf QString} \&n, bool \&ok) const 
\item 
{\bf QString\-List} {\bf available\-Encoding\-Names} ()
\item 
{\bf QString\-List} {\bf descriptive\-Encoding\-Names} ()
\item 
{\bf QString} {\bf language\-For\-Encoding} (const {\bf QString} \&encoding)
\item 
{\bf QString} {\bf encoding\-For\-Name} (const {\bf QString} \&descriptive\-Name)
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QChar} {\bf from\-Entity} (const {\bf QString} \&str)
\item 
static {\bf QChar} {\bf from\-Entity} (const {\bf QString} \&str, int \&len)
\item 
static {\bf QString} {\bf to\-Entity} (const {\bf QChar} \&ch)
\item 
static {\bf QString} {\bf resolve\-Entities} (const {\bf QString} \&text)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KCharsets} ()
\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KGlobal}\label{classKCharsets_n0}

\end{CompactItemize}


\subsection{Detailed Description}
Charset font and encoder/decoder handling. 

This is needed, because Qt's font matching algorithm gives the font family a higher priority than the charset. For many applications this is not acceptable, since it can totally obscure the output, in languages which use non iso-8859-1 charsets.

\begin{Desc}
\item[Author:]Lars Knoll $<${\tt knoll@kde.org}$>$ \end{Desc}




Definition at line 43 of file kcharsets.h.

\subsection{Constructor \& Destructor Documentation}
\index{KCharsets@{KCharsets}!KCharsets@{KCharsets}}
\index{KCharsets@{KCharsets}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KCharsets::KCharsets ()\hspace{0.3cm}{\tt  [protected]}}\label{classKCharsets_b0}


Protected constructor. 

If you need the kcharsets object, use {\bf KGlobal::charsets()}{\rm (p.\,\pageref{classKGlobal_e6})} instead. 

Definition at line 372 of file kcharsets.cpp.\index{KCharsets@{KCharsets}!~KCharsets@{$\sim$KCharsets}}
\index{~KCharsets@{$\sim$KCharsets}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KCharsets::$\sim${\bf KCharsets} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKCharsets_a0}


Destructor. 



Definition at line 377 of file kcharsets.cpp.

\subsection{Member Function Documentation}
\index{KCharsets@{KCharsets}!codecForName@{codecForName}}
\index{codecForName@{codecForName}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QText\-Codec} $\ast$ KCharsets::codec\-For\-Name (const {\bf QString} \& {\em name}) const}\label{classKCharsets_a1}


Provided for compatibility. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]the name of the codec \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the {\bf QText\-Codec}. If the desired codec could not be found, it returns a default (Latin-1) codec \end{Desc}


Definition at line 553 of file kcharsets.cpp.\index{KCharsets@{KCharsets}!codecForName@{codecForName}}
\index{codecForName@{codecForName}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QText\-Codec} $\ast$ KCharsets::codec\-For\-Name (const {\bf QString} \& {\em n}, bool \& {\em ok}) const}\label{classKCharsets_a2}


Tries to find a {\bf QText\-Codec} to convert the given encoding from and to Unicode. 

If no codec could be found the latin1 codec will be returned an {\tt ok} will be set to false. \begin{Desc}
\item[Returns:]the {\bf QText\-Codec}. If the desired codec could not be found, it returns a default (Latin-1) codec \end{Desc}


Definition at line 559 of file kcharsets.cpp.

References KLocale::codec\-For\-Encoding(), QText\-Codec::codec\-For\-Name(), KGlobal::config(), QCString::is\-Empty(), QCString::length(), QText\-Codec::load\-Charmap\-File(), KGlobal::locale(), QCString::lower(), KConfig\-Base::read\-Path\-Entry(), QCString::right(), QCString::truncate(), and QCString::upper().\index{KCharsets@{KCharsets}!fromEntity@{fromEntity}}
\index{fromEntity@{fromEntity}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QChar} KCharsets::from\-Entity (const {\bf QString} \& {\em str})\hspace{0.3cm}{\tt  [static]}}\label{classKCharsets_e0}


Converts an entity to a character. 

The string must contain only the entity without the trailing ';'. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the entity \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]QChar::null if the entity could not be decoded. \end{Desc}


Definition at line 382 of file kcharsets.cpp.

Referenced by from\-Entity(), and resolve\-Entities().\index{KCharsets@{KCharsets}!fromEntity@{fromEntity}}
\index{fromEntity@{fromEntity}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QChar} KCharsets::from\-Entity (const {\bf QString} \& {\em str}, int \& {\em len})\hspace{0.3cm}{\tt  [static]}}\label{classKCharsets_e1}


Overloaded member function. 

Tries to find an entity in the {\bf QString} str. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]the string containing entified \item[{\em len}]is a return value, that gives the length of the decoded entity. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a decoded entity if one could be found, QChar::null otherwise \end{Desc}


Definition at line 418 of file kcharsets.cpp.

References from\-Entity().\index{KCharsets@{KCharsets}!toEntity@{toEntity}}
\index{toEntity@{toEntity}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCharsets::to\-Entity (const {\bf QChar} \& {\em ch})\hspace{0.3cm}{\tt  [static]}}\label{classKCharsets_e2}


Converts a {\bf QChar} to an entity. 

The returned string does already contain the leading '\&' and the trailing ';'. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ch}]the char to convert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the entity \end{Desc}


Definition at line 434 of file kcharsets.cpp.

References QString::sprintf().\index{KCharsets@{KCharsets}!resolveEntities@{resolveEntities}}
\index{resolveEntities@{resolveEntities}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCharsets::resolve\-Entities (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [static]}}\label{classKCharsets_e3}


Scans the given string for entities (like \&amp;) and resolves them using from\-Entity. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the string containing the entities \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the clean string \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 441 of file kcharsets.cpp.

References from\-Entity(), QChar::is\-Null(), QString::length(), QString::remove(), and QString::unicode().\index{KCharsets@{KCharsets}!availableEncodingNames@{availableEncodingNames}}
\index{availableEncodingNames@{availableEncodingNames}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCharsets::available\-Encoding\-Names ()}\label{classKCharsets_a3}


Lists all available encodings as names. 

\begin{Desc}
\item[Returns:]the list of all encodings \end{Desc}


Definition at line 487 of file kcharsets.cpp.

Referenced by descriptive\-Encoding\-Names().\index{KCharsets@{KCharsets}!descriptiveEncodingNames@{descriptiveEncodingNames}}
\index{descriptiveEncodingNames@{descriptiveEncodingNames}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCharsets::descriptive\-Encoding\-Names ()}\label{classKCharsets_a4}


Lists the available encoding names together with a more descriptive language. 

\begin{Desc}
\item[Returns:]the list of descriptive encoding names \end{Desc}


Definition at line 541 of file kcharsets.cpp.

References QString::arg(), available\-Encoding\-Names(), KGlobal::charsets(), language\-For\-Encoding(), and QString\-List::sort().\index{KCharsets@{KCharsets}!languageForEncoding@{languageForEncoding}}
\index{languageForEncoding@{languageForEncoding}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCharsets::language\-For\-Encoding (const {\bf QString} \& {\em encoding})}\label{classKCharsets_a5}


Returns the language the encoding is used for. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding}]the encoding for the language \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the language of the encoding \end{Desc}


Definition at line 517 of file kcharsets.cpp.

Referenced by descriptive\-Encoding\-Names().\index{KCharsets@{KCharsets}!encodingForName@{encodingForName}}
\index{encodingForName@{encodingForName}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCharsets::encoding\-For\-Name (const {\bf QString} \& {\em descriptive\-Name})}\label{classKCharsets_a6}


Returns the encoding for a string obtained with {\bf descriptive\-Encoding\-Names()}{\rm (p.\,\pageref{classKCharsets_a4})}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em descriptive\-Name}]the descriptive name for the encoding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the name of the encoding \end{Desc}


Definition at line 524 of file kcharsets.cpp.

References QString::find\-Rev(), QString::left(), and QString::strip\-White\-Space().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kcharsets.h\item 
kcharsets.cpp\end{CompactItemize}
