apple / ccs-calendarserver

The Calendar and Contacts Server.
https://www.calendarserver.org
Apache License 2.0
486 stars 136 forks source link

Exception: Characterset does not work for french Translation #317

Closed macosforgebot closed 12 years ago

macosforgebot commented 13 years ago

mail@… originally submitted this as ticket:409


I set Language to "fr" to test the localization.

2011-02-06 19:46:36+0100 [-] [mailgateway] 2011-02-06 19:46:36+0100 [-] [twext.web2.server#error] [Failure instance: Traceback: <type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\xe0' in position 5: ordinal not in range(128)
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:345:errback
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:424:_startRunCallbacks
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:441:_runCallbacks
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:949:gotResult
2011-02-06 19:46:36+0100 [-] [mailgateway]      --- <exception caught here> ---
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:891:_inlineCallbacks
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/python/failure.py:338:throwExceptionIntoGenerator
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twistedcaldav/resource.py:309:renderHTTP
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:891:_inlineCallbacks
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/python/failure.py:338:throwExceptionIntoGenerator
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twext/web2/static.py:127:renderHTTP
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:891:_inlineCallbacks
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/python/failure.py:338:throwExceptionIntoGenerator
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twext/web2/resource.py:109:renderHTTP
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twisted/internet/defer.py:893:_inlineCallbacks
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twistedcaldav/mail.py:334:http_POST
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twistedcaldav/mail.py:940:outbound
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/site-packages/twistedcaldav/mail.py:1029:generateEmail
2011-02-06 19:46:36+0100 [-] [mailgateway]      /usr/lib/python2.6/encodings/utf_8.py:16:decode
2011-02-06 19:46:36+0100 [-] [mailgateway]      ]

This can be reproduced by

>>> u"à".decode("utf-8")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 0: ordinal not in range(128)
macosforgebot commented 13 years ago

mail@… originally submitted this as comment:1:⁠ticket:409


With

Index: CalendarServer/twistedcaldav/mail.py
===================================================================
--- CalendarServer/twistedcaldav/mail.py        (Revision 6892)
+++ CalendarServer/twistedcaldav/mail.py        (Arbeitskopie)
@@ -1024,10 +1024,6 @@
             else:
                 formatString = _("Event reply: %(summary)s")

-            # The translations we get back from gettext are utf-8 encoded
-            # strings, so convert to unicode
-            formatString = formatString.decode("utf-8")
-
             details['subject'] = msg['Subject'] = formatString % {
                 'summary' : details['summary']
             }

it works for me and the mails are nicely displayed. But maybe the have a bad encoding ...

macosforgebot commented 13 years ago

mail@… originally submitted this as comment:2:⁠ticket:409


probably the same as #⁠442

macosforgebot commented 13 years ago

@wsanchez originally submitted this as comment:3:⁠ticket:409

macosforgebot commented 13 years ago

@wsanchez originally submitted this as comment:4:⁠ticket:409

macosforgebot commented 13 years ago

@wsanchez originally submitted this as comment:5:⁠ticket:409

macosforgebot commented 12 years ago

@wsanchez originally submitted this as comment:6:⁠ticket:409

macosforgebot commented 12 years ago

@m0rgen originally submitted this as comment:7:⁠ticket:409


This code was changed fairly recently, and it should now be fixed.

macosforgebot commented 12 years ago

@wsanchez originally submitted this as comment:8:⁠ticket:409