Use UTF-8 for saving wxTextCtrl contents now.

This ensures that the files created by wxTextCtrl::SaveFile() can be read back
by wxTextCtrl::LoadFile() as previously the files were saved using the current
locale encoding but read back using Latin1 (after first trying, and failing,
to read them as UTF-8).

This is a backwards incompatible change but it ensures that wxTextCtrl can
load its own files and is also consistent with the use of UTF-8 by default in
other places. Finally, and perhaps most importantly, this ensures that the
file contents can always be saved, i.e. there is no risk of conversion errors
any more.

Closes #15611.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75073 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-10-26 20:29:32 +00:00
parent 2014950b1c
commit 9337103a37
2 changed files with 9 additions and 1 deletions

View File

@@ -927,7 +927,7 @@ bool wxTextAreaBase::DoSaveFile(const wxString& filename, int WXUNUSED(fileType)
{
#if wxUSE_FFILE
wxFFile file(filename, wxT("w"));
if ( file.IsOpened() && file.Write(GetValue(), *wxConvCurrent) )
if ( file.IsOpened() && file.Write(GetValue()) )
{
// if it worked, save for future calls
m_filename = filename;