# class KCharsets

###

Module | kdecore
Namespace |
Class | KCharsets
Inherits |

### methods

- KCharsets ( )

  returns ctor

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

- availableEncodingNames ( )

  returns QStringList

  Lists all available encodings as names. Returns the list of all encodings

- codecForName (name)

  returns QTextCodec

  Argument | Type | Default
  --- | --- | ---
  name | QString |

  Provided for compatibility.

  name - the name of the codec Returns the QTextCodec. If the desired codec could not be found, it returns a default (ISO 8859-1) codec

- codecForName (n)

  returns QTextCodec, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  n | QString |

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

  If no codec could be found, the ISO 8859-1 codec will be returned an and ok will be set to false.

  ok - true if a matching codec has been found, false if not Returns the QTextCodec. If the desired codec could not be found, it returns a default (ISO 8859-1) codec

- descriptionForEncoding (encoding)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  encoding | QString |

  Returns a long description for an encoding name.

  encoding - the encoding for the language Returns the long description for the encoding

- descriptiveEncodingNames ( )

  returns QStringList

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

- encodingForName (descriptiveName)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  descriptiveName | QString |

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

  descriptiveName - the descriptive name for the encoding Returns the name of the encoding

- encodingsByScript ( )

  returns QList<QStringList>

  Lists the available encoding names grouped by script (or language that uses them). Returns the list of lists consisting of description followed by encoding names (i.e. encodingsByScript().at(i).at(0) is a description for encodingsByScript().at(i).at(k), k>0)

- fromEntity (str)

  returns QChar
  static

  Argument | Type | Default
  --- | --- | ---
  str | QString |

  Converts an entity to a character.

  The string must contain only the entity without the trailing ';'.

  str - the entity Returns QChar.Null if the entity could not be decoded.

- fromEntity (str)

  returns QChar, int (len)
  static

  Argument | Type | Default
  --- | --- | ---
  str | QString |

  Overloaded member function. Tries to find an entity in the QString str.

  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, QChar.null otherwise

- languageForEncoding (encoding)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  encoding | QString |

  Returns the language the encoding is used for.

  encoding - the encoding for the language Returns the language of the encoding Deprecated Please use descriptionForEncoding instead. This function will be removed before KDE4 is released.

- resolveEntities (text)

  returns QString
  static

  Argument | Type | Default
  --- | --- | ---
  text | QString |

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

  text - the string containing the entities Returns the clean string

- toEntity (ch)

  returns QString
  static

  Argument | Type | Default
  --- | --- | ---
  ch | QChar |

  Converts a QChar to an entity. The returned string does already contain the leading '&' and the trailing ';'.

  ch - the char to convert Returns the entity