X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/865bb3251ecf83ddac350b734f4fed1d258e250b..7aabb2acd3db901fcb74b5eef6e62dd95d807d4d:/src/gtk/filedlg.cpp?ds=inline diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index e1082ea83e..c2dc478759 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -21,6 +21,7 @@ #include "wx/intl.h" #include "wx/filename.h" #include "wx/msgdlg.h" +#include "wx/log.h" #include @@ -43,7 +44,13 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog) { int style = dialog->GetStyle(); gchar* text = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); - wxString filename(wxGTK_CONV_BACK(text)); + wxString filename = wxConvFileName->cMB2WX( text ); + if ( filename.empty() ) + { + // this is totally lame but better than silent error + wxLogWarning(_("This filename can't be used by wxWidgets because it contains invalid UTF-8 characters, please rename the file.")); + return; + } if ((style & wxSAVE) && (style & wxOVERWRITE_PROMPT)) { @@ -292,7 +299,8 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const if (gpaths) g_slist_free(gpaths); } - else + + if ( paths.IsEmpty() ) { paths.Add(m_fileName); }