GNOME Bugzilla – Bug 166903
gedit mdi title does not handle correctly non-unicode filename
Last modified: 2005-07-29 08:55:36 UTC
Please describe the problem: I'm in G_FILENAME_ENCODING=@locale environment. When I open from or save to non-unicode filename, gedit's mdi title does not correctly display filename. It says that filename is "incorrect unicode". Yes, It is not unicode but "@locale" encoding. gedit should display filename correctly converted. Steps to reproduce: 1. set G_FILENAME_ENCODING=@locale and run gedit 2. open from or save to filename which are not subset of utf8 3. see the gedit's mdi title Actual results: broken character and incorrect unicode message Expected results: filename correctly converted Does this happen every time? yes Other information:
Created attachment 37278 [details] example screenshot
I'm having a hard time trying to reproduce in jp_JP. Can you attach a non-UTF8 file for me to try out?
You should ensure that 1. jp_JP is not correct, ja_JP is ok. 2. LANG variable's value is ja_JP.EUC-JP or ja_JP.SJIS, not ja_JP.UTF-8 3. G_FILENAME_ENCODING is @locale It's safe choosing non-utf-8 japanese locale in gdm login. Attaching "non-UTF-8 filename" file is not good idea because bugzilla does not memory the attached file's filename. If so, your browser may convert the filename's encoding. Please show me the result of 'echo $LANG', and 'echo $G_FILENAME_ENCODING'. I'm succeed to reproduce this problem in ja_JP.EUC-JP locale. You can reproduce this problem by following this 1. Make sure that ja_JP.EUC-JP locale is installed. 'locale -a' should show ja_JP.eucjp 2. Login via gdm selecting euc-jp japanese language environment 3. Run the terminal and make sure that 'locale' shows the correct result 4. Run 'G_FILENAME_ENCODING=@locale gedit' 5. Save to japanese filename You may be able to copy and paste japanese character from japanese desktop
sry, jp_JP was a type-o. OK I can reproduce with the following steps distilled from exactly what Eungkyu says above: 0. open a terminal 1. set LANG=<NON UTF-8 LOCALE> (ja_JP.EUC-JP works for testing purposes) 2. run G_FILENAME_ENCODING=@locale gedit 3. save file (which should already have translated Japanese in it) as any encoding Observe the title looks fine to the EUC gedit, however opening the file with the UTF-8 gedit, and the tab's title reads "Invalid unicode". In practise this appears to mean gedit should sniff the filename of every file it opens to learn what encoding the filename is in.
Created attachment 49888 [details] [review] This patch should fix the reported bug. Could you please apply it to CVS HEAD and test?
Fixed in CVS HEAD. 2005-07-28 Paolo Maggi <paolo@gnome.org> Fixed bug #166903 (this fix has been backported from the new_mdi branch). * gedit-document.c (get_uri_shortname_for_display) (update_uri_for_display): new functions (gedit_document_finalize): free new variables uri_for_display and short_name_for_display (gedit_document_get_raw_uri): removed "const" (gedit_document_get_uri): rewritten (gedit_document_get_short_name): ditto (gedit_document_set_uri): call update_uri_for_display (gedit_document_get_mime_type): removed "const". * gedit-document.h: removed some "const *" from prototypes.