tcp 経由でエンコードされた Unicode を含むランタイム文字列を受け取るアプリケーションを構築しています。私は次のものを持っていますが、残念ながら、コンパイル時にのみ恩恵を受けることができます: 不完全なユニバーサル文字名 \u コンパイル時に4つの16進数文字が予想されるため
QString restoreUnicode(QString strText)
{
QRegExp rx("\\\\u([0-9a-z]){4}");
return strText.replace(rx, QString::fromUtf8("\u\\1"));
}
実行時に解決策を探しています。これらの文字列を分割し、「\ u」区切り文字の後の 16 進数を基数 10 に変換して QChar のコンストラクターに渡す操作を予見できますが、探しています私はそのような方法によって発生する時間の複雑さについて非常に懸念しており、専門家ではないため、存在する場合はより良い方法を求めて.
誰でも解決策やヒントを持っていますか。