UnicodeWarning parsing a date on Windows

Bug #1227221 reported by remram44 on 2013-09-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

On Python 2.7, time.tzname can contain bytestrings in ISO-8859-15 format. For example, with my locale set to French, the tuple is: ('Est', 'Est (heure d\x92\xe9t\xe9)')

Because _result.tzname is unicode, the test res.tzname in time.tzname in parser.parser line 336 causes a UnicodeWarning as one of the elements cannot be converted to unicode for comparison (it is not ASCII).

C:\Python2.7.5\lib\site-packages\dateutil\parser.py:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal

remram44 (remirampin) wrote :

I'm using Python 2.7.5 and dateutil 2.1 (from pip).

George (dynkin) wrote :

Same here(Python 2.7, dateutils dateutil 2.1, localte Japanese/cp932)

on Windows, Python uses the name “mbcs” to refer to whatever the currently configured encoding is. “mbcs” is handy handy for converting back and forth between Unicode and bytestrings.

remram44 (remirampin) wrote :

Still present in dateutil 2.2.

jarondl (jarondl) wrote :

Hopefully fixed in current master (or >=2.5.0) as tracked in the github issue: https://github.com/dateutil/dateutil/issues/92

Changed in dateutil:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers