How to force QString to serialize as UTF-8?



  • Hello, the QString serializes by default (via QDataStream) as UTF-16. This inflates the resulting file to more than twice the original size if the original string was encoded as UTF-8 which has variable size of each character. Is there a way to let QString be serialized in UTF-8 (or encoding of user's choosing) instead of default UTF-16? I am aware of a work-arounds such as storing cstring or QByteArray and reconsdtructing the QString from them when deserializing but I am looking for more direct approach.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.