Sur cette page

QTextEncoder Class

La classe `QTextEncoder` fournit un encodeur à état. En savoir plus...

En-tête : #include <QTextEncoder>
CMake : find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat)
qmake : QT += core5compat

Remarque : toutes les fonctions de cette classe sont réentrantes.

Fonctions publiques

QTextEncoder(const QTextCodec *codec)
QTextEncoder(const QTextCodec *codec, int flags)
~QTextEncoder()
QByteArray fromUnicode(const QString &str)
QByteArray fromUnicode(QStringView str)
QByteArray fromUnicode(const QChar *uc, int len)

Description détaillée

Un encodeur de texte convertit du texte Unicode en un format de texte encodé à l'aide d'un codec spécifique.

L'encodeur convertit l'Unicode en un autre format, en mémorisant tout état requis entre les appels.

Voir également QTextCodec::makeEncoder() et QTextDecoder.

Documentation des fonctions membres

[explicit] QTextEncoder::QTextEncoder(const QTextCodec *codec)

Crée un encodeur de texte pour l'codec.

[explicit] QTextEncoder::QTextEncoder(const QTextCodec *codec, int flags)

Crée un encodeur de texte pour l'codec on et la conversion flags données.

[noexcept] QTextEncoder::~QTextEncoder()

Détruit le codeur.

QByteArray QTextEncoder::fromUnicode(const QString &str)

Convertit la chaîne Unicode str en une chaîne encodée QByteArray.

QByteArray QTextEncoder::fromUnicode(QStringView str)

Convertit la chaîne Unicode str en une chaîne encodée QByteArray.

Il s'agit d'une fonction surchargée.

QByteArray QTextEncoder::fromUnicode(const QChar *uc, int len)

Convertit les caractères « len » (et non les octets) à partir de « uc », et renvoie le résultat dans un « QByteArray ».

Il s'agit d'une fonction surchargée.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.