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 69140 - We should have a g_utf8_strftime()
We should have a g_utf8_strftime()
Status: RESOLVED DUPLICATE of bug 50076
Product: glib
Classification: Platform
Component: general
2.0.x
Other other
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 58573 405469 (view as bug list)
Depends on:
Blocks: 127349
 
 
Reported: 2002-01-19 22:34 UTC by Gediminas Paulauskas
Modified: 2011-02-18 16:13 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
This patch implements g_utf8_strftime function (2.68 KB, patch)
2002-01-20 15:23 UTC, Gediminas Paulauskas
rejected Details | Review
makes g_date_strftime use wcsftime which should be much more efficient than converting and using strftime. (1.29 KB, patch)
2002-01-20 15:30 UTC, Gediminas Paulauskas
rejected Details | Review

Description Gediminas Paulauskas 2002-01-19 22:34:04 UTC
There is a need for strftime() equivalent, which accepts UTF-8 format string,
and returns UTF-8 string. Also, it should return a newly-allocated string
of needed size, as other glib functions do.

You might want to look at what glib/gunicollate.c does with
wcscoll; using wcsftime when available and the wcs encoding is appropriate
can give you a properly Unicode "strftime" independent of the locale.

When wcsftime is not available, g_utf8_strftime should convert format
string to locale encoding, call strftime, and convert result back into
utf-8 (look at eel/eel-glib-extensions.c for example).

The same improvement could be made to g_date_strftime
Comment 1 Gediminas Paulauskas 2002-01-20 15:23:44 UTC
Created attachment 6454 [details] [review]
This patch implements g_utf8_strftime function
Comment 2 Gediminas Paulauskas 2002-01-20 15:30:53 UTC
Created attachment 6455 [details] [review]
makes g_date_strftime use wcsftime which should be much more efficient than converting and using strftime.
Comment 3 Gediminas Paulauskas 2002-05-27 10:17:00 UTC
I have created a new bug 83145 for g_date_strftime optimization.

This implementation of g_utf8_strftime does not care if buffer passed
to strftime is long enough, but I guess it should, as g_date_strftime
does.
Comment 4 Owen Taylor 2002-10-15 21:43:21 UTC
strftime has the worst possible buffer management handling
imaginable. If we add something in this area it shouldn't
be called strftime or act exactly like strftime. 

char *g_format_time (const char *format, const struct tm *time);

Would be my preference. But this probably shoudl actually
be done within the framework of bug 50076.
Comment 5 Owen Taylor 2002-10-15 21:45:54 UTC
*** Bug 58573 has been marked as a duplicate of this bug. ***
Comment 6 Christian Rose 2004-02-29 14:16:09 UTC
There are some extensions to the strftime specifiers that are needed,
and that would be excellent to have in a glib equivalent of strftime.
See bug 127349 for one example.
Comment 7 Federico Mena Quintero 2006-04-06 15:43:59 UTC
See also bug #325064, which is about a simpler API for formatting dates/times.
Comment 8 Matthias Clasen 2007-03-16 04:28:44 UTC
*** Bug 405469 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Clasen 2010-07-09 00:33:04 UTC
This is covered by the api in bug 50076

*** This bug has been marked as a duplicate of bug 50076 ***