|  | Home · All Classes · Modules

# QTextEncoder Class Reference
[QtCore module]

The QTextEncoder class provides a state-based encoder. More...

### Methods

- __init__ (self, QTextCodec codec)
- __init__ (self, QTextCodec codec, QTextCodec.ConversionFlags flags)
- QByteArray fromUnicode (self, QString str)

## Detailed Description

The QTextEncoder class provides a state-based encoder.

A text encoder converts text from Unicode into an encoded text format using a specific codec.

The encoder converts Unicode into another format, remembering any state that is required between calls.

## Method Documentation

### QTextEncoder.__init__ (self, QTextCodec codec)

Constructs a text encoder for the given codec.

### QTextEncoder.__init__ (self, QTextCodec codec, QTextCodec.ConversionFlags flags)

Constructs a text encoder for the given codec and conversion flags.

This function was introduced in Qt 4.7.

### QByteArray QTextEncoder.fromUnicode (self, QString str)

Converts the Unicode string str into an encoded QByteArray.