\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} ()
\begin{CompactList}\small\item\em Destructor. \item\end{CompactList}\item 
{\bf QText\-Codec} $\ast$ {\bf codec\-For\-Name} (const  {\bf QString} \&name) const 
\begin{CompactList}\small\item\em Provided for compatibility. \item\end{CompactList}\item 
{\bf QText\-Codec} $\ast$ {\bf codec\-For\-Name} (const  {\bf QString} \&n, bool \&ok) const 
\begin{CompactList}\small\item\em Tries to find a {\bf QText\-Codec} to convert the given encoding from and to Unicode. \item\end{CompactList}\item 
{\bf QString\-List} {\bf available\-Encoding\-Names} ()
\begin{CompactList}\small\item\em Lists all available encodings as names. \item\end{CompactList}\item 
{\bf QString\-List} {\bf descriptive\-Encoding\-Names} ()
\begin{CompactList}\small\item\em Lists the available encoding names together with a more descriptive language. \item\end{CompactList}\item 
{\bf QString\-List} {\bf languages} ()
\begin{CompactList}\small\item\em Lists all languages. \item\end{CompactList}\item 
{\bf QString\-List} {\bf encodings\-For\-Language} (const  {\bf QString} \&language)
\begin{CompactList}\small\item\em Lists all available encodings for language name 'language'. \item\end{CompactList}\item 
{\bf QString} {\bf language\-For\-Encoding} (const  {\bf QString} \&encoding)
\begin{CompactList}\small\item\em Returns the language the encoding is used for. \item\end{CompactList}\item 
{\bf QString} {\bf encoding\-For\-Name} (const  {\bf QString} \&descriptive\-Name)
\begin{CompactList}\small\item\em Returns the encoding for a string obtained with {\bf descriptive\-Encoding\-Names()}{\rm (p.\,\pageref{classKCharsets_a4})}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
{\bf QChar} {\bf from\-Entity} (const  {\bf QString} \&str)
\begin{CompactList}\small\item\em Converts an entity to a character. \item\end{CompactList}\item 
{\bf QChar} {\bf from\-Entity} (const  {\bf QString} \&str, int \&len)
\begin{CompactList}\small\item\em Overloaded member function. \item\end{CompactList}\item 
{\bf QString} {\bf to\-Entity} (const  {\bf QChar} \&ch)
\begin{CompactList}\small\item\em Converts a {\bf QChar} to an entity. \item\end{CompactList}\item 
{\bf QString} {\bf resolve\-Entities} (const  {\bf QString} \&text)
\begin{CompactList}\small\item\em Scans the given string for entities (like \&amp;) and resolves them using from\-Entity. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KCharsets} ()
\begin{CompactList}\small\item\em Protected constructor. \item\end{CompactList}\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}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf kcharsets.h}{\rm (p.\,\pageref{kcharsets_8h})},v 1.53.2.1 2003/02/09 13:55:28 rnolden Exp \end{Desc}
\end{Desc}




Definition at line 44 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_e5})}() instead. 

Definition at line 346 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 351 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 517 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 523 of file kcharsets.cpp.

References KLocale::codec\-For\-Encoding(), QText\-Codec::codec\-For\-Name(), KGlobal::config(), QString::from\-Latin1(), QCString::is\-Empty(), QString::is\-Empty(), KStd\-Accel::key(), QString::latin1(), QText\-Codec::load\-Charmap\-File(), KGlobal::locale(), QCString::lower(), QString::lower(), KStd\-Action::name(), KConfig\-Base::read\-Path\-Entry(), 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 356 of file kcharsets.cpp.

References QString::ascii(), QString::length(), QString::to\-Int(), and QString::unicode().

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 392 of file kcharsets.cpp.

References from\-Entity(), and QString::left().\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 408 of file kcharsets.cpp.

References QString::sprintf(), and QChar::unicode().\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 415 of file kcharsets.cpp.

References KStd\-Accel::end(), 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 461 of file kcharsets.cpp.

References QString::from\-Latin1().

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 505 of file kcharsets.cpp.

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


Lists all languages. 

\begin{Desc}
\item[Returns:]a list of all languages \end{Desc}
\index{KCharsets@{KCharsets}!encodingsForLanguage@{encodingsForLanguage}}
\index{encodingsForLanguage@{encodingsForLanguage}!KCharsets@{KCharsets}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCharsets::encodings\-For\-Language (const {\bf QString} \& {\em language})}\label{classKCharsets_a6}


Lists all available encodings for language name 'language'. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em language}]to language to search for \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the list of encodings for the language \end{Desc}
\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_a7}


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 491 of file kcharsets.cpp.

References QString::latin1().

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_a8}


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 the}]descriptive name for the encoding \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the name of the encoding \end{Desc}


Definition at line 498 of file kcharsets.cpp.

References QString::find(), and QString::mid().

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