New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
external strftime for Python? #47423
Comments
Back in April we had a thread on xmlrpclib's problematic handling of dates
I'm still of the opinion that strftime() is the culprit and xmlrpclib is I took a different approach and scouted around for an existing version of Also, see http://bugs.python.org/issue1777412 which appears to be related. |
Ummm... I think I only modified timemodule.c. datetimemodule.c |
So how does it work for non-English locales? |
Good question. I don't claim that the strftime.c I found is complete S |
The issue bpo-1777412 has a working patch (for Python 2.6) which allows |
What platforms have broken strftime and how badly is it broken there? Is there a python version somewhere? PyPy? |
PyPy also calls the platform's strftime(). |
What about the licensing? That look like the BSD license *with* advertising clause... |
On Wed, Jul 28, 2010 at 11:22 PM, Guido van Rossum
I am not a lawyer and I am not intimately familiar with PSF policies, # Permission to use, copy, modify, and distribute this Python software Actually, I wonder if pydoc profile is technically in violation of the Skip, can you clarify where the strftime code in your patch came from? On the other hand, unless strftime code is already published under an |
Maybe rather than spending the effort maintaining a legacy API such as strftime, someone could look into implementing localized date formatting as defined by recent Unicode standards: http://unicode.org/reports/tr35/#Date_Format_Patterns Apparently there is a free implementation for Python out there: http://babel.edgewall.org/wiki/Documentation/dates.html#pattern-syntax |
I think we're stuck with strftime for quite a while, no matter how ugly it is. datetime.__format__ uses it, for example. Although maybe it's possible to write an strftime-format to new-format translator. If we're going to take this on (re-writing strftime), I think the way to do it is to have it take the locale info as a parameter, and if that parameter is NULL then look up the info in the current locale. It looks like it's still a problem to find all of the info in the locale on all platforms, though. Finding the locale info is no doubt the tricky part, as someone said. I agree it would be easier to write this from scratch rather than track down the licensing on the existing patch. As it is, there's just not much code there. |
On Thu, Jan 6, 2011 at 2:56 PM, Eric Smith <report@bugs.python.org> wrote:
You may want to take a look at BSD-ish strftime_l function which is http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html |
On Thu, Jan 6, 2011 at 11:56 AM, Eric Smith <report@bugs.python.org> wrote:
Hm, shouldn't the libc locale support offer the same set of locales |
The Qt library has its own strftime() implementation. The QLocale object has methods providing localized day and month names. For example, day names are implemented using a big ushort array (~20.000 bytes) which contains something like 'Sun;Mon;Tue;Wed;Thu;Fri;Sat;Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;S;M;T;W;T;F;S;7;1;2;3;4;5;6;;;;;;;;Dil;Wix;Qib;Rob;Kam;Jim;San;Dilbata;Wiixata;Qibxata;Roobii;Kamiisa;Jimaata;Sanbata;A;E;T;A;K;G;S;Aca;Etl;Tal;Arb;Kam;Gum;Sab;Acaada;Etleeni;Talaata;Arbaqa;Kamiisi;Gumqata;Sabti;1;2;3;4;5;6;7;So;Ma;Di;Wo;Do;Vr;Sa;Sondag;Maandag;Dinsdag;Woensdag;Donderdag;Vrydag;Saterdag;D;H;M;M;E;P;S;Die;H\xebn;Mar;M\xebr;(...)'. |
Is nl_langinfo() function reliable? On any OS? Can we use it to get day name, abbreviated day name, month name and abbreviated month name? We should maybe start with an implementation in Python? It's easier to write code in Python than in C, and because it can be reused on other Python implementations. |
This scheme is very elegant. I’d love to have built-in/stdlib support for it. Would it need to be implemented in C?
Babel just rocks :) |
IANA is now distributing Olson's timezone database software which includes an implementation of strftime(): http://www.iana.org/time-zones/repository/releases/tzcode2012b.tar.gz The code was designated as public domain by Arthur David Olson, but it seems to be based on code copyrighted by UCB and distributed under the BSD license. The code does seem to include some locale support. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: