-#if defined(__WINDOWS__)
- c = _T('\r');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
- c = _T('\n');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
-#elif defined(__UNIX__)
- c = _T('\n');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
-#elif defined(__WXMAC__)
- c = _T('\r');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
-#elif defined(__OS2__)
- c = _T('\r');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
- c = _T('\n');
- m_output->Write( (const void*)(&c), sizeof(wxChar) );
+ switch ( m_mode )
+ {
+ case wxEOL_DOS:
+ out << _T("\r\n");
+ continue;
+
+ case wxEOL_MAC:
+ out << _T('\r');
+ continue;
+
+ default:
+ wxFAIL_MSG( _T("unknown EOL mode in wxTextOutputStream") );
+ // fall through
+
+ case wxEOL_UNIX:
+ // don't treat '\n' specially
+ ;
+ }
+ }
+
+ out << c;
+ }
+
+#if wxUSE_UNICODE
+ // 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);