Skip to content

Gio.CharsetConverter

class — extends GObject.Object, Converter, Initable

GCharsetConverter is an implementation of Converter based on GLib.IConv.

Constructors

new

@classmethod
def new(cls, to_charset: str, from_charset: str) -> CharsetConverter

Creates a new CharsetConverter.

Parameters:

  • to_charset — destination charset
  • from_charset — source charset

Methods

get_num_fallbacks

def get_num_fallbacks(self) -> int

Gets the number of fallbacks that converter has applied so far.

get_use_fallback

def get_use_fallback(self) -> bool

Gets the CharsetConverter:use-fallback property.

set_use_fallback

def set_use_fallback(self, use_fallback: bool) -> None

Sets the CharsetConverter:use-fallback property.

Parameters:

  • use_fallbackTrue to use fallbacks

Properties

from_charset

from_charset: str  # read/write

The character encoding to convert from.

to_charset

to_charset: str  # read/write

The character encoding to convert to.

use_fallback

use_fallback: bool  # read/write

Use fallback (of form \<hexval>) for invalid bytes.