After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 166903 - gedit mdi title does not handle correctly non-unicode filename
gedit mdi title does not handle correctly non-unicode filename
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
2.8.x
Other All
: Normal major
: 2.12.0
Assigned To: Gedit maintainers
gedit QA volunteers
Depends on:
Blocks:
 
 
Reported: 2005-02-10 09:30 UTC by Eungkyu Song
Modified: 2005-07-29 08:55 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8


Attachments
example screenshot (23.41 KB, image/png)
2005-02-10 09:31 UTC, Eungkyu Song
  Details
This patch should fix the reported bug. (7.19 KB, patch)
2005-07-28 16:01 UTC, Paolo Maggi
none Details | Review

Description Eungkyu Song 2005-02-10 09:30:09 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:
Comment 1 Eungkyu Song 2005-02-10 09:31:10 UTC
Created attachment 37278 [details]
example screenshot
Comment 2 Ryan McDougall 2005-03-04 09:14:41 UTC
I'm having a hard time trying to reproduce in jp_JP. Can you attach a non-UTF8
file for me to try out?
Comment 3 Eungkyu Song 2005-03-04 13:27:19 UTC
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
Comment 4 Ryan McDougall 2005-03-16 03:32:03 UTC
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.
Comment 5 Paolo Maggi 2005-07-28 16:01:08 UTC
Created attachment 49888 [details] [review]
This patch should fix the reported bug.

Could you please apply it to CVS HEAD and test?
Comment 6 Paolo Maggi 2005-07-28 16:53:50 UTC
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.