このページでは

QTextEncoder Class

QTextEncoder クラスは、状態ベースのエンコーダを提供します。詳細...

ヘッダー: #include <QTextEncoder>
CMake: find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
target_link_libraries(mytarget PRIVATE Qt6::Core5Compat)
qmake: QT += core5compat

注:このクラスのすべての関数は再入可能である。

パブリック関数

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)

詳細な説明

テキストエンコーダは、特定のコーデックを使用して、テキストをUnicodeからエンコードされたテキスト形式に変換します。

エンコーダは、呼び出し間で必要な状態を記憶しながら、Unicode を別の形式に変換します。

QTextCodec::makeEncoder() およびQTextDecoderも参照してください 。

メンバ関数のドキュメント

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

指定されたcodec 用のテキストエンコーダを構築します。

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

指定されたcodec および変換関数flags に対して、テキストエンコーダを構築します。

[noexcept] QTextEncoder::~QTextEncoder()

エンコーダを破壊する。

QByteArray QTextEncoder::fromUnicode(const QString &str)

Unicode文字列 `str ` を、エンコードされた `QByteArray` に変換します。

QByteArray QTextEncoder::fromUnicode(QStringView str)

Unicode文字列 `str ` を、エンコードされた `QByteArray` に変換します。

これはオーバーロードされた関数です。

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

uc から `len ` 文字(バイトではない)を変換し、その結果を `QByteArray` として返します。

これはオーバーロードされた関数です。

© 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.