Merge branch 'fs-mem-string-data'
Use UTF-8 for memory FS data if it's not in Latin-1. See https://github.com/wxWidgets/wxWidgets/pull/2622 See #19314.
This commit is contained in:
@@ -180,7 +180,12 @@ void wxMemoryFSHandlerBase::AddFileWithMimeType(const wxString& filename,
|
||||
const wxString& textdata,
|
||||
const wxString& mimetype)
|
||||
{
|
||||
const wxCharBuffer buf(textdata.To8BitData());
|
||||
// We try to use the provided data "as is" if possible, but if not, we fall
|
||||
// back to UTF-8 because it's better to do this than just lose the data
|
||||
// completely.
|
||||
wxCharBuffer buf(textdata.To8BitData());
|
||||
if ( !buf.length() )
|
||||
buf = textdata.utf8_str();
|
||||
|
||||
AddFileWithMimeType(filename, buf.data(), buf.length(), mimetype);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user