I suggest this change instead and I will put it in trunk
from:
if isinstance(text, str):
to:
if isinstance(text, (str,unicode)):

On Dec 22, 9:43 am, "hamdy.a.farag" <hamdy.a.fa...@inbox.com> wrote:
> Hi there
>
> I'd the same problem
>
> I couldn't send arabic messages whatever I did and the
> encoding='utf-8'  option seems also not working
>
> I tried all the above tricks but invain
>
> then I tried to convert both subject and message to utf-8
> so I did it for subjet : subject = unicode(form.vars.subject)
> and it worked correctly !!! arabic characters are now showing up
> but things went crazy for body
> it ave me an exception on a line on tools.py saying that unicode
> object has no read() function
>
> if text != None:
>                 if isinstance(text, str):
>                     attachment.attach(email.MIMEText.MIMEText
> (text.encode(encoding)))
>                 else:
>                     attachment.attach(email.MIMEText.MIMEText(text.read
> ().encode(encoding)))
> ##################here####################
>             if html != None:
>                 if isinstance(html, str):
>                     attachment.attach(email.MIMEText.MIMEText
> (html.encode(encoding), 'html'))
>
> so I removed the read() and guess what ? it worked correctly
> Now I don't know whether this's a bug/typo or not but without doing so
> I couldn't have utf-8 working in messages
> so any comments about that ?

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to