org.kde.koala

Class KCharsets

public class KCharsets extends Object implements QtSupport

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.

Author: Lars Knoll

UNKNOWN: Charset font and encoder/decoder handling.

Constructor Summary
protected KCharsets(Class dummy)
KCharsets()
Protected constructor.
Method Summary
ArrayListavailableEncodingNames()
Lists all available encodings as names.
QTextCodeccodecForName(String name)
Provided for compatibility.
QTextCodeccodecForName(String n, boolean ok)
Tries to find a QTextCodec to convert the given encoding from and to Unicode.
ArrayListdescriptiveEncodingNames()
Lists the available encoding names together with a more descriptive language.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
StringencodingForName(String descriptiveName)
Returns the encoding for a string obtained with descriptiveEncodingNames().
protected voidfinalize()
Deletes the wrapped C++ instance
static charfromEntity(String str)
Converts an entity to a character.
static charfromEntity(String str, int[] len)
Overloaded member function.
booleanisDisposed()
Has the wrapped C++ instance been deleted?
StringlanguageForEncoding(String encoding)
Returns the language the encoding is used for.
static StringresolveEntities(String text)
Scans the given string for entities (like &) and resolves them using fromEntity.
static StringtoEntity(char ch)
Converts a char to an entity.

Constructor Detail

KCharsets

protected KCharsets(Class dummy)

KCharsets

public KCharsets()
Protected constructor. If you need the kcharsets object, use KGlobal.charsets() instead.

UNKNOWN: Protected constructor.

Method Detail

availableEncodingNames

public ArrayList availableEncodingNames()
Lists all available encodings as names.

Returns: the list of all encodings

UNKNOWN: Lists all available encodings as names.

codecForName

public QTextCodec codecForName(String name)
Provided for compatibility.

Parameters: name the name of the codec

Returns: the QTextCodec. If the desired codec could not be found, it returns a default (Latin-1) codec

UNKNOWN: Provided for compatibility.

codecForName

public QTextCodec codecForName(String n, boolean ok)
Tries to find a QTextCodec to convert the given encoding from and to Unicode. If no codec could be found the latin1 codec will be returned an ok will be set to false.

Returns: the QTextCodec. If the desired codec could not be found, it returns a default (Latin-1) codec

UNKNOWN: Tries to find a QTextCodec to convert the given encoding from and to Unicode.

descriptiveEncodingNames

public ArrayList descriptiveEncodingNames()
Lists the available encoding names together with a more descriptive language.

Returns: the list of descriptive encoding names

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

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

encodingForName

public String encodingForName(String descriptiveName)
Returns the encoding for a string obtained with descriptiveEncodingNames().

Parameters: descriptiveName the descriptive name for the encoding

Returns: the name of the encoding

UNKNOWN: Returns the encoding for a string obtained with descriptiveEncodingNames().

finalize

protected void finalize()
Deletes the wrapped C++ instance

fromEntity

public static char fromEntity(String str)
Converts an entity to a character. The string must contain only the entity without the trailing ';'.

Parameters: str the entity

Returns: char.null if the entity could not be decoded.

UNKNOWN: Converts an entity to a character.

fromEntity

public static char fromEntity(String str, int[] len)
Overloaded member function. Tries to find an entity in the String str.

Parameters: str the string containing entified len is a return value, that gives the length of the decoded entity.

Returns: a decoded entity if one could be found, char.null otherwise

UNKNOWN: Overloaded member function.

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

languageForEncoding

public String languageForEncoding(String encoding)
Returns the language the encoding is used for.

Parameters: encoding the encoding for the language

Returns: the language of the encoding

UNKNOWN: Returns the language the encoding is used for.

resolveEntities

public static String resolveEntities(String text)
Scans the given string for entities (like &) and resolves them using fromEntity.

Parameters: text the string containing the entities

Returns: the clean string

UNKNOWN: Scans the given string for entities (like &) and resolves them using fromEntity.

toEntity

public static String toEntity(char ch)
Converts a char to an entity. The returned string does already contain the leading '&' and the trailing ';'.

Parameters: ch the char to convert

Returns: the entity

UNKNOWN: Converts a char to an entity.