From: Vadim Zeitlin Date: Thu, 24 Mar 2005 02:42:15 +0000 (+0000) Subject: lame temporary "fix" for file names which are not UTF-8 encoded X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/01b92baa9c59457765e7a5ed1df74f45d4bcd80b?ds=inline lame temporary "fix" for file names which are not UTF-8 encoded git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index e1082ea83e..3c909e79bf 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 @@ -44,6 +45,12 @@ 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)); + 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)) { diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index e1082ea83e..3c909e79bf 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -21,6 +21,7 @@ #include "wx/intl.h" #include "wx/filename.h" #include "wx/msgdlg.h" +#include "wx/log.h" #include @@ -44,6 +45,12 @@ 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)); + 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)) {