[issue8304] strftime and Unicode characters

2014-08-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I verified Marks 3.4.1 result with Idle.

It strikes me as a bug that a function that maps a unicode format string to a 
unicode string with interpolations added should ever encode the format to 
bytes, lets alone using using an encoding that fails or loses information.  It 
is especially weird given that % formatting does not even work (at present) for 
bytes.

It seems to me that strftime should never encode the non-special parts of the 
format text.  Instead, it could split the format (re.split) into a list of 
alternatine '%x' pairs and running text segments, replace the '%x' entries with 
the proper entries, and return the list joined back into a string. Some 
replacements would be locale dependent, other not.

(Just wondering, are the locate names of days and months bytes restricted to 
ascii or unrestricted unicode using native characters?)

--
nosy: +terry.reedy
versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2014-07-10 Thread Mark Lawrence

Mark Lawrence added the comment:

Using 3.4.1 and 3.5.0 I get:-

time.strftime("%d\u200F%A", time.gmtime())
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'locale' codec can't encode character '\u200f' in position 
2: Illegal byte sequence

--
nosy: +BreamoreBoy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2012-04-25 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy:  -brian.curtin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2012-04-25 Thread STINNER Victor

STINNER Victor  added the comment:

> Actually the bug seems related to Windows.

See also the issue #10653: wcsftime() doesn't format correctly time zones, so 
Python 3 uses strftime() instead.

--
nosy: +haypo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2010-04-04 Thread Brian Curtin

Changes by Brian Curtin :


--
versions:  -Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2010-04-04 Thread AndiDog

AndiDog  added the comment:

Definitely a Windows problem. I did this on Visual Studio 2008:

wchar_t out[1000];
time_t currentTime;
time(¤tTime);
tm *timeStruct = gmtime(¤tTime);

size_t ret = wcsftime(out, 1000, L"%d%A", timeStruct);
wprintf(L"ret = %d, out = (%s)\n", ret, out);

ret = wcsftime(out, 1000, L"%d\u200f%A", timeStruct);
wprintf(L"ret = %d, out = (%s)\n", ret, out);

and the output was

ret = 8, out = (04Sunday)
ret = 0, out = ()

Python really shouldn't use any so-called standard functions on Windows. They 
never work as expected ^^...

--
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2010-04-04 Thread AndiDog

AndiDog  added the comment:

Just installed Python 3.1.2, same problem. I'm using Windows XP SP2 with two 
Python installations (2.6.4 and now 3.1.2).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2010-04-03 Thread Ezio Melotti

Ezio Melotti  added the comment:

Actually the bug seems related to Windows.

--
components: +Windows
nosy: +brian.curtin
status: pending -> open
versions: +Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2010-04-03 Thread Ezio Melotti

Ezio Melotti  added the comment:

This seems to be fixed now, on both 3.1 and 3.2.
Can you try with 3.1.2 and see if it works?
What operating system are you using?

--
nosy: +ezio.melotti
priority:  -> normal
status: open -> pending
versions:  -Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2010-04-03 Thread Eric Smith

Changes by Eric Smith :


--
nosy: +eric.smith

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8304] strftime and Unicode characters

2010-04-03 Thread AndiDog

New submission from AndiDog :

There is inconsistent behavior in time.strftime, comparing Python 2.6 and 3.1. 
In 3.1, non-ASCII Unicode characters seem to get dropped whereas in 2.6 you can 
keep them using the necessary Unicode-to-UTF8 workaround.

This should be fixed if it isn't intended behavior.

Python 2.6

>>> time.strftime(u"%d\u200F%A".encode("utf-8"), time.gmtime()).decode("utf-8")
u'03\u200fSaturday'
>>> time.strftime(u"%d\u0041%A".encode("utf-8"), time.gmtime()).decode("utf-8")
u'03ASaturday'

Python 3.1

>>> time.strftime("%d\u200F%A", time.gmtime())
''
>>> len(time.strftime("%d\u200F%A", time.gmtime()))
0
>>> time.strftime("%d\u0041%A", time.gmtime())
'03ASaturday'

--
components: Library (Lib), Unicode
messages: 102269
nosy: AndiDog
severity: normal
status: open
title: strftime and Unicode characters
type: behavior
versions: Python 2.6, Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com