]> git.saurik.com Git - wxWidgets.git/commitdiff
also fixed WriteString() to work correctly when outputting UTF-16/32: can't use strle...
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 5 Apr 2006 16:28:29 +0000 (16:28 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 5 Apr 2006 16:28:29 +0000 (16:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/txtstrm.cpp

index cbc90a4dae72dc8c670f8366b3bfac89f044e87a..299a97cf29c4baec5499d83b23ea855d206ee6e4 100644 (file)
@@ -414,10 +414,10 @@ void wxTextOutputStream::WriteString(const wxString& string)
         out << c;
     }
 
-    // We must not write the trailing NULL here
 #if wxUSE_UNICODE
-    wxCharBuffer buffer = m_conv->cWC2MB( out );
-    m_output.Write( (const char*) buffer, strlen( (const char*) buffer ) );
+    // 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());
 #else
     m_output.Write(out.c_str(), out.length() );
 #endif