- // note that we must not write the trailing NUL here
- wxCharBuffer buffer = m_conv->cWC2MB(out, out.length(), &len);
- m_output.Write(buffer, len + 1 - m_conv->GetMBNulLen());
+ // FIXME-UTF8: use wxCharBufferWithLength if/when we have it
+ wxCharBuffer buffer = m_conv->cWC2MB(out.wc_str(), out.length(), &len);
+ m_output.Write(buffer, len);