qt - Get QString length in bytes (not characters) -


i need solve problem opposite this one. have qstring non-ascii symbols.
example:
schöne grüße

how length of string in bytes utf8 case? should 15.
have tried conversion bytearray, latin1, ascii length same.

you need use ::toutf8() , append qbytearray. can length using .size().

qstring s = "schöne grüße"; qbytearray bytes = s.toutf8(); int length = bytes.size(); //number of bytes 

http://harmattan-dev.nokia.com/docs/platform-api-reference/xml/daily-docs/libqt4/qbytearray.html#size


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

java - SmsManager sending message more than one -