- //Get length of converted string
- size_t dwConvLen = conv.MB2WC(NULL, (*this).c_str(), 0, length());
-
- //if valid, do the conversion
- if (dwConvLen != (size_t) -1)
- {
- //Create good buffer
- wxWCharBuffer buffer(dwConvLen + 1);
-
- //Do the actual conversion
- conv.MB2WC(buffer.data(), (*this).c_str(), dwConvLen + 1, length());
-
- return buffer;
- }
-
- //create bogus buffer
- wxWCharBuffer buffer(1);
- buffer.data()[0u] = 0;
- return buffer;