wxString & it's length
Steven Van Ingelgem
steven at vaningelgem.be
Thu Mar 6 06:08:44 PST 2008
wxMSW + VS2k3
Hi,
I have been thinking about how to save the contents of a wxString.
The problems I face is:
- If I get "Len()" to save the length, right now it returns in
UTF8-build the amount of bytes (and not the actual characters). Same
seems to apply when using wxStringData.
The problem here is: can I base my code on this behaviour? If not, is
there a way to get the actual length of this string?
- What if the string has NULL values in it? ie. Is wxString binary safe?
What I was thinking is doing something like utf8_str() and than saving
the # of bytes and than the data.
But I can't get the byte length from wxCharBuffer (I can't get any
length for that matter).
What should I do best to save the contents of a wxString?
I saw a fixme in the wxStringStream sources which said to use the
"wxCharBufferWithLength", but has this already been made?
Thanks a lot
More information about the wx-users
mailing list