Convert text in other encoding qt
Unsolved
General and Desktop
-
-
@RIVOPICO
use QTextCodec::fromUnicode()QTextCodec * codec = QTextCodec::codecForName("CodecName") QByteArray data = codec->fromUnicode( utf8Str );
For a possible list of codec values you can use QTextCodec::availableCodecs()
-
QTextCodec * codec = QTextCodec::codecForName("CodecName") QByteArray encodedData = codec->fromUnicode( ui->textocuenta->text().toUtf8() ); encodedData = QByteArray("|@|") + encodedData + QByteArray("|@|");
-
@RIVOPICO Did you check that codec is not null?
QTextCodec * codec = QTextCodec::codecForName("CodecName");
What did you pass as codec name?
In such situations you should always debug first to see where and why your app crashes.