1. changed all "wxMBConv& conv" parameters to "const wxMBConv&"
2. this allows to use wxConvAuto() instead of wxConvUTF8 as default value for this parameter in the classes which read text from the file: wxConvAuto automatically recognizes the BOM at the start of file and uses the correct conversion 3. don't use Windows for UTF-7 conversions as there is no way to make it fail on invalid UTF-7 strings; use our own wxMBConvUtf7 instead git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wx/filefn.h"
|
||||
#include "wx/convauto.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -54,14 +55,14 @@ public:
|
||||
|
||||
// read/write (unbuffered)
|
||||
// read all data from the file into a string (useful for text files)
|
||||
bool ReadAll(wxString *str, wxMBConv& conv = wxConvUTF8);
|
||||
bool ReadAll(wxString *str, const wxMBConv& conv = wxConvAuto());
|
||||
// returns number of bytes read - use Eof() and Error() to see if an error
|
||||
// occurred or not
|
||||
size_t Read(void *pBuf, size_t nCount);
|
||||
// returns the number of bytes written
|
||||
size_t Write(const void *pBuf, size_t nCount);
|
||||
// returns true on success
|
||||
bool Write(const wxString& s, wxMBConv& conv = wxConvUTF8)
|
||||
bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto())
|
||||
{
|
||||
const wxWX2MBbuf buf = s.mb_str(conv);
|
||||
size_t size = strlen(buf);
|
||||
|
Reference in New Issue
Block a user