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:
parent
2014950b1c
commit
9337103a37
@ -493,6 +493,13 @@ Deprecated methods and their replacements
|
||||
Changes in behaviour visible to end users
|
||||
-----------------------------------------
|
||||
|
||||
- wxTextCtrl::SaveFile() now creates UTF-8-encoded files instead of using the
|
||||
default locale encoding. This ensures that the entire text control contents
|
||||
can be saved and is consistent with the use of UTF-8 by default in the other
|
||||
places, notably DoLoadFile(), but is a change since the previous versions.
|
||||
If you need the old behaviour, consider calling wxFFile::Write() explicitly
|
||||
with wxConvCurrent conversion parameter.
|
||||
|
||||
- In wxMSW wxSpinCtrl used to prevent the user from entering more digits than
|
||||
could fit in its visible area. This was inconsistent with the other ports and
|
||||
now the control scrolls if too much text is added.
|
||||
@ -565,6 +572,7 @@ Major new features in this release
|
||||
|
||||
All:
|
||||
|
||||
- wxTextFile::SaveFile() uses UTF-8 now.
|
||||
- Add possibility to validate the input files against a schema to wxrc.
|
||||
- Fix recently broken compilation with Intel compiler.
|
||||
- Fix reading of files with Mac EOLs in wxTextFile.
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user