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

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -