Issue 5249: Fix strftime on windows.
Created on 2009-02-13 16:24 by ocean-city, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| fix_strftime_on_windows.patch | ocean-city, 2009-02-13 16:24 | |||
| experimental_wcsftime.patch | ocean-city, 2009-02-14 05:32 | this is not fix. just experimental patch | ||
| Messages (8) | |||
|---|---|---|---|
| msg81946 - (view) | Author: Hirokazu Yamamoto (ocean-city) * ![]() |
Date: 2009-02-13 16:24 | |
On windows, format string should be encoded as mbcs. Otherwise, result of strftime would be broken. Here is the patch. |
|||
| msg81981 - (view) | Author: Martin v. Löwis (loewis) * ![]() |
Date: 2009-02-14 00:12 | |
I think we should use wcsftime on Windows, even though it works very similar to your patch (with the primary difference being that it uses alloca instead of Py_Malloc). |
|||
| msg81993 - (view) | Author: Hirokazu Yamamoto (ocean-city) * ![]() |
Date: 2009-02-14 05:32 | |
I experimentally implemented with wcsftime, but I couldn't get same result as strftime + mbcs conversion. Probably because wcsftime depends on locale. |
|||
| msg81994 - (view) | Author: Hirokazu Yamamoto (ocean-city) * ![]() |
Date: 2009-02-14 06:00 | |
Sorry, if we use wcsftime, I cannot create the patch. On VC6, wcsftime returns not unicode but mbcs string which copied to wchar array. Maybe on snakebite.org, I can access VC9 and confirm its behavior on it? ;-) |
|||
| msg81998 - (view) | Author: Martin v. Löwis (loewis) * ![]() |
Date: 2009-02-14 07:42 | |
> On VC6, wcsftime simply converts *format* to mbcs string, calls > strftime, and converts result to unicode, so there is no difference > between my patch and wcsftime. Right. > (Newer VC's wcsftime might have different > implementation though) Maybe you are concerning about the cost of extra > unicode object creation on non-windows platform? No. I'm concerned primarily about code cleanliness, by relying on library code rather than implementing stuff ourselves. OTOH, the conversion to narrow strings still needs to happen on Unix (and probably needs to use the locale's encoding, not UTF-8), so a uniform treatment also has a value. |
|||
| msg82222 - (view) | Author: Hirokazu Yamamoto (ocean-city) * ![]() |
Date: 2009-02-16 07:50 | |
Locale is my weak point. :-( If there is locale encoding function like PyUnicode_DecodeFSDefault for file system encoding, I think I can use it. |
|||
| msg82225 - (view) | Author: Martin v. Löwis (loewis) * ![]() |
Date: 2009-02-16 08:24 | |
Using TZNAME_ENCODING is fine; I just think it has an incorrect value on Unix. All in all, I think the (original) patch is fine, please apply. |
|||
| msg82228 - (view) | Author: Hirokazu Yamamoto (ocean-city) * ![]() |
Date: 2009-02-16 09:30 | |
Thanks, fixed in r69664(py3k) and r69665(release30-maint). |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:45 | admin | set | github: 49499 |
| 2010-04-27 20:32:07 | loewis | set | priority: normal |
| 2009-02-16 09:30:04 | ocean-city | set | status: open -> closed priority: high -> (no value) messages: + msg82228 resolution: accepted -> fixed stage: commit review -> resolved |
| 2009-02-16 08:24:18 | loewis | set | resolution: accepted messages: + msg82225 |
| 2009-02-16 07:50:57 | ocean-city | set | messages: + msg82222 |
| 2009-02-14 07:42:20 | loewis | set | messages: + msg81998 |
| 2009-02-14 06:00:48 | ocean-city | set | messages: + msg81994 |
| 2009-02-14 05:39:46 | ocean-city | set | messages: - msg81992 |
| 2009-02-14 05:32:38 | ocean-city | set | files:
+ experimental_wcsftime.patch messages: + msg81993 |
| 2009-02-14 04:29:32 | ocean-city | set | messages: + msg81992 |
| 2009-02-14 00:12:33 | loewis | set | nosy:
+ loewis messages: + msg81981 |
| 2009-02-13 17:26:57 | kevinwatters | set | nosy: + kevinwatters |
| 2009-02-13 16:36:38 | ocean-city | set | priority: high |
| 2009-02-13 16:30:38 | ocean-city | link | issue5239 dependencies |
| 2009-02-13 16:24:07 | ocean-city | create | |
