#2971: Unicode encoding error w/ Windows & defined locale
-----------------------------+----------------------------------------------
 Reporter:  eblot            |        Owner:  cboos
     Type:  defect           |       Status:  new  
 Priority:  normal           |    Milestone:  0.10 
Component:  general          |      Version:  devel
 Severity:  major            |   Resolution:       
 Keywords:  unicode windows  |  
-----------------------------+----------------------------------------------
Comment (by cboos):

 Emmanuel, this fix worked for me, could you try it out?
 {{{
 Index: trac/util/__init__.py
 ===================================================================
 --- trac/util/__init__.py       (revision 3118)
 +++ trac/util/__init__.py       (working copy)
 @@ -208,8 +208,8 @@
              t = time.localtime(int(t))

      text = time.strftime(format, t)
 -    encoding = locale.getlocale(locale.LC_TIME)[1] or \
 -               locale.getpreferredencoding()
 +    lc_time_encoding = sys.platform != 'win32' and
 getlocale(locale.LC_TIME)[1]
 +    encoding = lc_time_encoding or locale.getpreferredencoding()
      return unicode(text, encoding, 'replace')

  def format_date(t=None, format='%x', gmt=False):
 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2971>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to