GNOME Bugzilla – Bug 548947
In non-UTF-8 locale date is not displayed correctly.
Last modified: 2008-09-24 17:40:07 UTC
Please describe the problem: When a user login to a non-UTF-8 locale, and launch GNOME Commander(don't update folders under $HOME to non-UTF-8 encoding names when login), "day" and "month" in displayed time of files are garbage characters. Steps to reproduce: 1. Login to GNOME with a non-UTF-8 locale, such as zh_CN.GBK 2. Launch gnome-commander 3. Check the date of files displayed Actual results: "day" and "month" in displayed time of files are garbage characters. Expected results: Localized "day" and "month" are displayed. Does this happen every time? Yes. Other information: utils.cc::time2string() needs to be revised.
Created attachment 117982 [details] [review] patch to handle non-UTF-8 encoding date
Created attachment 118056 [details] [review] patch to handle non-UTF8 encoding date, revised As for time2string() is used very intensely by gcmd, I'd rather keep expensive calls to g_locale_to_utf8() as low as possible... Why to convert date_format from locale to UTF8? IMHO date_format is pure ASCII (like %X or %Y.%m.%d %T), so it doesn't need any conversion. I've attached the revised patch - could you, please, verify if it works for you?
Created attachment 118067 [details] [Settings] -> [Option] -> [Format] dialog tab > Why to convert date_format from locale to UTF8? The format can be customized in GUI. I think it needs to be UTF-8 instead of ASCII. Please find the attachment.
Created attachment 118327 [details] [review] patch to handle non-UTF8 encoding date, rev. 3 Right, I see it now... Please verify the attached patch if it is working for you. gcmd stores internally date_format in locale format now, converting it from/to UTF8 when appropriate (loading/saving cfg file and editing in GUI). This way we can still save one call to g_locale_to_utf8(). Please do test.
Created attachment 118410 [details] [review] Patch for src/gnome-cmd-options-dialog.cc, src/utils.cc > Created an attachment (id=118327) [edit] Unfortunately I got garbaged strings with your patch on the option GUI dialog. + gnome_cmd_data_set_date_format (g_locale_from_utf8 (format, -1, NULL, NULL, NULL)); I'm not sure why you need the locale value instead of UTF-8. However I'd like to recommend to use UTF-8 as the internal encoding and use the locale encoding in case we use the native APIs or output/input user files. How about the attached patch? It works fine with me.
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.