GNOME Bugzilla – Bug 323853
evolution cannot import task files with none UTF-8 filenames.
Last modified: 2013-09-13 01:00:44 UTC
Version details: trunk 2.4 1. Invoke evolution on none UTF8 locale.(eg. zh_CN.gb18030. On Linux, please set "G_FILENAME_ENCODING = gb18030") 2. Choose [File] -> [New] -> [Task] and launch [Task - No summary] dialog 3. Input task information in the dialog, click [Save] button and close the dialog. 4. Select [Local Folders] -> [Tasks] in Folder pane. 5. Right click on the saved task, choose [Save as...] and launch [Save as...] dialog. 6. Input Chinese filename and save the task as the file. 7. Choose [File] -> [Import] and launch [Import Assistant] dialog. 8. Choose [Forward], Select [Import a single file], Choose [Forward], Input the saved task file, Choose [Automatic] file type, Choose [Forward], Choose [ Import] button. Then cannot import the localized task name in non-utf8 encoding.
Created attachment 55883 [details] [review] Patch The filename got from gtk_entry_get_text() is always in UTF-8 encoding. In order to operate this file, we need to convert the filename to its original on-disk encoding. Therefore, apart from filenames whose on-disk encoding are UTF-8, other filenames should be converted to the Glib encoding.
confirming and targetting. should go both into 2.4.x and HEAD.
Created attachment 56434 [details] [review] patch As gnome_file_entry_get_full_path() has supported non-utf8 encoding name(pls see #321144), use gnome_file_entry_get_full_path() instead of gtk_entry_get_text().
Surely there must be lots of other places in Evolution and E-D-S where there there is confusion between UTF-8 and the GLib (on-disk) file name encoding? Presumably most Linux installations use UTF-8 filenames, which is why this hasn't caused more problems.
Tor, just as you said. On Linux and Windows Glib encoding is usually UTF-8, even locale is non-utf8. But on solaris Glib encoding is usually the same as locale, so the non-utf8 encoding filenames are met easily. Do you agree to commit this patch?
Sure, I don't object committing this patch. I was just pondering out loud whether there aren't dozens of other places in Evo that need similar attention, and adding g_filename_to/from_utf8() calls.
I agree with Tor - there are other places where there this latent assumption exists. However, gnome_file_entry_get_full_path() is a deprecated call. I wonder if there is a better substitute - though I do not have one to suggest atm.
I'll try to extend to all the code regarding GnomeFileEntry and GnomePixmapEntry. As for substitute, the widget GnomeFileEntry is actually deprecated. Instead, GtkFileChooserButton is being using since GTK 2.6+. If we done this, many change will be made. I'm not sure if it's suitable. What about your idea?
>grep -r 'gnome_file_entry_get_full_path' ~/gnome-cvs/evolution/* mail/em-composer-prefs.c plugins/save-attachments/save-attachments.c not that much. :-)
Created attachment 58062 [details] [review] fix the bug 323853 Harish, I have replaced GnomeFileEntry by GtkFileChooserButton, which can import task files with none UTF-8 filenames. But there are some shortcomings: 1. we can't input the file name but select the existing file; 2. the button can't show the full path of the selected file.
As GnomeFileEntry and GnomePixmapEntry are deprecated, there're the following codes that need to be changed too. evolution/mail/em-mailer-prefs.c evolution/mail/em-composer-prefs.c evolution/filter/filter-file.c evolution/plugins/save-attachments/save-attachments.c gtkhtml-3.9.4/components/html-editor/image.c gtkhtml-3.9.4/components/html-editor/body.c gtkhtml-3.9.4/components/html-editor/cell.c gtkhtml-3.9.4/components/html-editor/table.c
The approach looks fine. can you extend the patch to other files (as discussed in IRC) - so the change can be absorbed in one shot ?
Harish, as you know, we will take the spring festival vacation. So we don't have time to make all those changes before the UI freeze day. So we will have to make the changes for Evolution 2.7/2.8.
Re-targeting this for GNOME Beta2 (2.13.91)
Created attachment 58913 [details] [review] replace GnomeFileEntry by GtkFileChooserButton in mail pref
Created attachment 58919 [details] [review] replace GnomeFileEntry by GtkFileChooserButton in mail pref
Created attachment 58931 [details] [review] replace GnomeFileEntry by GtkFileChooserButton in composer pref & mail pref
Created attachment 58935 [details] [review] replace GnomeFileEntry by GtkFileChooserButton in file filter
Harish, yesterday Nancy fell down on her way home after overtime work and was hurt seriously. She might be break for two weeks. Could you possibly review three current patches and check in firstly?
Created attachment 59832 [details] [review] replace GnomeFileEntry and GnomePixmapEntry by GtkFileChooserButton, In gtkhtml/components/html-editor/cell.c, image.c, table.c, cell.c
Harish, shipu complete the remaining patches. Could you please review all the patches?
I reviewed it It looks fine. still I need to apply and test. Ill confirm tomorrow. Just one issue below - GtkWidget *entry; + GtkEntry *entry; + GtkFileChooserButton *button; - entry = glade_xml_get_widget (prefs->sig_script_gui, "fileentry_add_script_script"); - gnome_file_entry_set_filename ((GnomeFileEntry *) entry, sig->filename); + button = glade_xml_get_widget (prefs->sig_script_gui, "filechooserbutton_add_script"); + gtk_file_chooser_set_filename ((GtkFileChooser *) button, sig->filename); entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name"); gtk_entry_set_text (GTK_ENTRY (entry), sig->name); This for sure will emit a warning. Just preserve GtkWidget and dont put GtkEntry There are 2-3 similiar occurances. Just fix them. Ill test the rest tomorrow and confirm. Thanks.
Srinivasa, thanks for your suggestion. We'll modify it before checking.
Srinivasa, i have modified as ur suggestion. And i shall ask simon to obselete elder ones.
Created attachment 60286 [details] [review] [New] replace GnomeFileEntry by GtkFileChooserButton in composer pref & mail pref
Created attachment 60287 [details] [review] [New] replace GnomeFileEntry by GtkFileChooserButton in file filter Does anybody could obsolete elder ones? i have no right to do it.
the elder ones are: id #56434, #58931 and #58935
Created attachment 60303 [details] [review] Replace GnomeFileEntry by GtkFileChooserButton in Plugins/save-attachment
Created attachment 60536 [details] [review] [Corrected]replace GnomeFileEntry and GnomePixmapEntry by GtkFileChooserButton, In gtkhtml/components/html-editor/cell.c, image.c, table.c, cell.c
Created attachment 60537 [details] [review] [Corrected]replace GnomeFileEntry by GtkFileChooserButton in file filter
Created attachment 60538 [details] [review] [Corrected]replace GnomeFileEntry by GtkFileChooserButton in composer pref & mail pref
Created attachment 60539 [details] [review] [Corrected]Replace GnomeFileEntry by GtkFileChooserButton in Plugins/save-attachment
Created attachment 60540 [details] [review] [Corrected]Replace GnomeFileEntry by GtkFileChooserButton in shell/e-shell-importer.c
srag, just a reminder. Please approve these patches for HEAD. Thanks!
Looks fine to commit to HEAD.
patch committed to head, please close the bug