Submitted by : 127.0.0.1 at: 2006-01-19T13:37:34+00:00 (11 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

Writing a non ASCII text ("hé oui, comme ça") in a RST page (didn't try other formats) in an UTF-8 Plone 2.1 raises an UnicodeError? when sending mail.

Note that my zope.conf has rest-input-encoding and rest-output-encoding set to utf-8.

Ze traceback

Traceback (innermost last):
  Module ZPublisher.Publish, line 113, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 40, in call_object
  Module Products.ZWiki.Editing, line 286, in edit
  Module Products.ZWiki.Editing, line 380, in handleEditText
  Module Products.ZWiki.Mail, line 670, in sendMailToEditSubscribers
  Module Products.ZWiki.Mail, line 714, in sendMailTo
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 17: ordinal not in range(128)

A similar report: #1114 .

can't reproduce --simon, Thu, 19 Jan 2006 14:30:55 -0800 reply

I can't reproduce it at TestPage. Of course I may not be pasting exactly what you typed; I copied and pasted your text from this page.

Plone context --Mon, 23 Jan 2006 03:21:07 -0800 reply

The error was raised in a Zwiki/Plone page.

I tried the TestPage direcly from keyboard and look at the result... In addition, the TestPage runs in a pure Zwiki, not in a Plone site.

After having a look at the sendMailTo method, it seems that building the mail body doesn't care about the Plone charset, and encodes to ASCII whatever's the charset.

Simple fix --monteiro, Wed, 01 Feb 2006 09:39:33 -0800 reply

Hello, I had the same problem, using similar versions. After some debugging, i discovered that the error was generated when calling listIdHeader() I changed the way it gets the folder title and everything fixed itself. The changed code for this function is:

def listIdHeader(self):
    """
    Give the appropriate List-ID: header for mail-outs from this page.
    """
    return '%s <%s>' % (self.folder().Title(),self.listId())

Simple fix --simon, Wed, 01 Feb 2006 23:35:00 -0800 reply

Thanks. That code works only in CMF/Plone. Also, can you explain why it worked for you ? Calling Title() is the same as accessing .title as far as I can see. I suspect the problem is more widespread than just this method.

Simple fix --Encolpe Degoute, Thu, 02 Feb 2006 00:43:05 -0800 reply

Not exactly. Calling 'Title' method in Archetypes call the i18n stuff and accessing not.

Simple fix --Simon Michael, Thu, 02 Feb 2006 00:46:23 -0800 reply

Ah; I forgot to look in Archetypes.

Simple fix --Encolpe Degoute, Thu, 02 Feb 2006 01:22:44 -0800 reply

In 'Mail.subjectHeader':

if getattr(self.folder(),'mail_page_name',1):
    pagename = '[%s] ' % self.Title() or self.id

It's a little dirty, but I drank to much yesterday

**(property change) ** --simon, Sun, 26 Feb 2006 13:16:41 -0800 reply

Name: '#1204 Mailing with Plone 2.1, ZWiki 0.49 and non ASCII text' => '#1204 mail-out of non-ascii edits can break with a unicode error'

need to reproduce & test --simon, Mon, 27 Feb 2006 10:43:29 -0800 reply

Can someone experiencing any bug like this tell me: your system's locale, and give a (preferably short) page name/page text that should trigger it.

need to reproduce & test --EmmaLaurijssens, Fri, 07 Apr 2006 04:23:21 -0700 reply

ZWiki server locale: en-US, client locale: nl-NL

it happens with all messages containing non-ascii characters. Didn't we do something like:

msg.encode('ascii','replace')

I vaguely remember that in the old days mailouts contained question marks instead of non-ascii characters.

... --EmmaLaurijssens, Wed, 17 May 2006 02:21:33 -0700 reply

Name: '#1204 irish' => '#1204 mail-out of non-ascii edits can break with a unicode error'

... --EmmaLaurijssens, Wed, 17 May 2006 02:25:24 -0700 reply

Status: closed => open

pretty sure this works now --simon, Thu, 01 May 2008 21:21:33 -0700 reply

Status: open => closed