Convert the format to the current locale before passing it to strtime().

2007-10-10  Emmanuele Bassi  <ebassi@gnome.org>

	* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Convert
	the format to the current locale before passing it to
	strtime(). Fixes corrupt dates with non-UTF8 encodings on
	OpenSolaris. (#465380, Takao Fujiwara)

svn path=/trunk/; revision=18903
This commit is contained in:
Emmanuele Bassi 2007-10-10 08:09:13 +00:00 committed by Emmanuele Bassi
parent 928db3a71b
commit 2ad0ef4632
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2007-10-10 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Convert
the format to the current locale before passing it to
strtime(). Fixes corrupt dates with non-UTF8 encodings on
OpenSolaris. (#465380, Takao Fujiwara)
2007-10-10 Emmanuele Bassi <ebassi@gnome.org>
* gtk/gtkfilechooserdefault.c (list_mtime_data_func): Fix the

View File

@ -11101,6 +11101,7 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
struct tm tm_mtime;
time_t time_now;
const gchar *format;
gchar *locale_format = NULL;
gchar buf[256];
#ifdef HAVE_LOCALTIME_R
@ -11143,10 +11144,14 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column,
format = "%x"; /* Any other date */
}
if (strftime (buf, sizeof (buf), format, &tm_mtime) != 0)
locale_format = g_locale_from_utf8 (format, -1, NULL, NULL, NULL);
if (strftime (buf, sizeof (buf), locale_format, &tm_mtime) != 0)
date_str = g_locale_to_utf8 (buf, -1, NULL, NULL, NULL);
else
date_str = g_strdup (_("Unknown"));
g_free (locale_format);
}
g_object_set (cell,