[issue5905] strptime fails in non-UTF locale

2011-12-09 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 8620e6901e58 by Victor Stinner in branch '3.2':
Issue #5905: time.strftime() is now using the locale encoding, instead of
http://hg.python.org/cpython/rev/8620e6901e58

New changeset bee7694988a4 by Victor Stinner in branch 'default':
(Merge 3.2) Issue #5905: time.strftime() is now using the locale encoding,
http://hg.python.org/cpython/rev/bee7694988a4

--
nosy: +python-dev

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



[issue5905] strptime fails in non-UTF locale

2011-12-09 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
resolution:  - fixed
status: open - closed

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



[issue5905] strptime fails in non-UTF locale

2011-12-08 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oh! I think that I understood the problem: if HAVE_WCSFTIME is not defined, 
timemodule.c uses strftime(), instead of wcsftime(), encode input format and 
decode the format. It uses UTF-8 to encode/decode, whereas the right encoding 
is the locale encoding. Attached patch should fix this issue.

@Antoine: Do you have any idea why HAVE_WCSFTIME was not defined?

wcsftime() is defined in wchar.h on Ubuntu. In configure, it is tested using 
AC_CHECK_FUNCS(wcsftime)

--
components: +Unicode
keywords: +patch
resolution: invalid - 
status: closed - open
Added file: http://bugs.python.org/file23881/tzname_encoding.patch

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



[issue5905] strptime fails in non-UTF locale

2011-12-08 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Well, it seems defined here:

$ grep HAVE_WCSFTIME pyconfig.h
1071:#define HAVE_WCSFTIME 1

 Attached patch should fix this issue.

I'm sorry, I can't test the patch, because my Linux distro (Mageia) doesn't 
have the fr_FR.ISO8859-15 locale anymore :-(

--

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



[issue5905] strptime fails in non-UTF locale

2011-06-20 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I close the issue because I am unable to reproduce it.

--
resolution:  - invalid
status: open - closed

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



[issue5905] strptime fails in non-UTF locale

2011-06-12 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Still a problem in 3.2.1 or 3.3?

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

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



[issue5905] strptime fails in non-UTF locale

2010-08-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 I can't reproduce this on Windows ...

This issue is (was?) maybe specific to Linux.

--

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



[issue5905] strptime fails in non-UTF locale

2010-08-05 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I can't reproduce this on Windows Vista with 3.1 or 3.2 despite trying several 
Western  Eastern European, Chinese  Japanese locales.

--
nosy: +BreamoreBoy

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



[issue5905] strptime fails in non-UTF locale

2010-01-21 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

I'm unable to reproduce the error. I tried locales fr_FR.iso88591 and 
fr_fr.iso885...@euro (fr...@euro), but the example works correctly. Should the 
terminal use the specified locale? My terminal uses fr_FR.utF8 locale. Should 
set_locale() be called before loaded time and/or calendar module?

--
nosy: +haypo

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



[issue5905] strptime fails in non-UTF locale

2010-01-15 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti, lemburg
versions:  -Python 3.0

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



[issue5905] strptime fails in non-UTF locale

2010-01-15 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

The reason for this is that the strftime() C lib API is used to build localized 
month names. With your setting, you'll get French Latin-1 month names and those 
cannot be coerced to UTF-8 due to the accented characters in them.

This works in Python 2.x since PyUnicode_FromString() et al. convert Latin-1 
strings to Unicode.

Apparently, this was changed in Python 3.x without looking at the header file 
or looking at the Python 2.x implementation which mandate Latin-1 as input 
encoding. Even the Python 3.x header still says that PyUnicode_FromString() 
will convert from Latin-1 to Unicode.

No idea why time.strptime() even bothers with these month names, though, since 
neither the format string nor the string being parsed contains literal month 
names.

--

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



[issue5905] strptime fails in non-UTF locale

2009-05-02 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

time.strptime() fails with non-UTF8 locales, *even when the input is
totally ASCII*.

 locale.setlocale(locale.LC_TIME, fr_FR.ISO8859-15)
'fr_FR.ISO8859-15'
 time.strptime(2009-01-01, %Y-%m-%d)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/antoine/py3k/__svn__/Lib/_strptime.py, line 461, in
_strptime_time
return _strptime(data_string, format)[0]
  File /home/antoine/py3k/__svn__/Lib/_strptime.py, line 307, in _strptime
_TimeRE_cache = TimeRE()
  File /home/antoine/py3k/__svn__/Lib/_strptime.py, line 188, in __init__
self.locale_time = LocaleTime()
  File /home/antoine/py3k/__svn__/Lib/_strptime.py, line 72, in __init__
self.__calc_month()
  File /home/antoine/py3k/__svn__/Lib/_strptime.py, line 98, in
__calc_month
a_month = [calendar.month_abbr[i].lower() for i in range(13)]
  File /home/antoine/py3k/__svn__/Lib/_strptime.py, line 98, in listcomp
a_month = [calendar.month_abbr[i].lower() for i in range(13)]
  File /home/antoine/py3k/__svn__/Lib/calendar.py, line 60, in __getitem__
return funcs(self.format)
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1-3:
invalid data

--
components: Library (Lib)
messages: 86953
nosy: pitrou
priority: critical
severity: normal
stage: test needed
status: open
title: strptime fails in non-UTF locale
type: behavior
versions: Python 3.0, Python 3.1

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