QTextCodec in its current form does not exist in Qt6 (actually it exists, but as part of the qt5compat module).
As a replacement Qt6 has QStringConverter: https://doc-snapshots.qt.io/qt6-dev/qstringconverter.html
The good news is that stuff like `textstream.setCodec(QTextCodec::codecForName("UTF-8"));` is no longer needed in Qt6 since QTextStream defaults to utf-8.
The bad news is that QStringConverter does not support most of the codecs that QTextCodec supports. It only supports only UTF-8/16/32 and Latin1. See https://bugreports.qt.io/browse/QTBUG-75665 for context. I some places, e.g. Kate we allow the user to choose from a wide range of codecs. https://bugreports.qt.io/browse/QTBUG-86437 indicates that support for other codecs may come back in a future Qt6 release in some form.
QTextCodec is part of the API of KCharSets, which offers additional API around it, e.g. resolving alternative names. Other than that it's not used in public frameworks API, but used internally quite a bit.
Sonnet makes use of QTextCodec internally. One usage is removed by https://invent.kde.org/frameworks/sonnet/-/merge_requests/18. The hunspell plugin uses it to convert from QString to the dict's encoding. All dicts on my system seem to be either UTF-8 or ISO8859-1 (`ag -G "\.aff$" "^SET"`), if we can assume that QString or QStringConverter API should be enough. The hspell plugin requires `iso8859-8-i`, that is not covered by QStringConverter.