- size_t len = text.length();
-#if wxUSE_UNICODE
- const wxCharBuffer textMB(wxConvLibc.cWC2MB(text.wc_str(), len + 1, &len));
-#else
- const char *textMB = text.c_str();
-#endif
-
- sos.Write(textMB, len);
+ const wxCharBuffer buf(text.To8BitData());
+ sos.Write(buf, buf.length());