Google Groups Home
Help | Sign in
TurboMail and unicode problem
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Johnny Blonde  
View profile
 More options May 2 2007, 7:51 am
From: Johnny Blonde <frank.wagner.1...@googlemail.com>
Date: Wed, 02 May 2007 11:51:11 -0000
Local: Wed, May 2 2007 7:51 am
Subject: TurboMail and unicode problem
Hello Group,

i am trying to set up some scheduled tasks which will have to send
emails.

the email-content is to be rendered by kid and then passed to an
instance of TurboMail.Message

the template is rendered correctly, but when passing it to the
message, i receive encoding errors.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
67: ordinal not in range(128).

what can i do about that? i think i´m using the latest version of
turbomail 2.0.3

Regards,
 Frank


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dmhwsm  
View profile
 More options May 2 2007, 9:16 am
From: dmhwsm <weinh...@unileoben.ac.at>
Date: Wed, 02 May 2007 06:16:46 -0700
Local: Wed, May 2 2007 9:16 am
Subject: Re: TurboMail and unicode problem

> the template is rendered correctly, but when passing it to the
> message, i receive encoding errors.
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 67: ordinal not in range(128).

once I have had the same error-message (working with an utf-8 encoded
database)

it was solved by creating the file
    /usr/lib64/python2.4/site-packages/sitecustomize.py
containing the two following lines :
   import sys
   sys.setdefaultencoding("utf-8")

but this can disturb your non utf-8 python-scripts

happy pythoning

Herbert


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johnny Blonde  
View profile
 More options May 2 2007, 9:55 am
From: Johnny Blonde <frank.wagner.1...@googlemail.com>
Date: Wed, 02 May 2007 13:55:07 -0000
Local: Wed, May 2 2007 9:55 am
Subject: Re: TurboMail and unicode problem
thanks - that solved it... i hope all other scripts that are run on
this server are utf-8 too...

On 2 Mai, 15:16, dmhwsm <weinh...@unileoben.ac.at> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diez B. Roggisch  
View profile
 More options May 4 2007, 4:55 am
From: "Diez B. Roggisch" <diez.roggi...@artnology.com>
Date: Fri, 4 May 2007 10:55:00 +0200
Subject: Re: [TurboGears] Re: TurboMail and unicode problem
On Wednesday 02 May 2007 15:16, dmhwsm wrote:

> > the template is rendered correctly, but when passing it to the
> > message, i receive encoding errors.
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> > 67: ordinal not in range(128).

> once I have had the same error-message (working with an utf-8 encoded
> database)

> it was solved by creating the file
>     /usr/lib64/python2.4/site-packages/sitecustomize.py
> containing the two following lines :
>    import sys
>    sys.setdefaultencoding("utf-8")

> but this can disturb your non utf-8 python-scripts

Because of this it's a really bad advice. Don't do that!

Diez


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diez B. Roggisch  
View profile
 More options May 4 2007, 4:56 am
From: "Diez B. Roggisch" <diez.roggi...@artnology.com>
Date: Fri, 4 May 2007 10:56:02 +0200
Local: Fri, May 4 2007 4:56 am
Subject: Re: [TurboGears] TurboMail and unicode problem
On Wednesday 02 May 2007 13:51, Johnny Blonde wrote:

> Hello Group,

> i am trying to set up some scheduled tasks which will have to send
> emails.

> the email-content is to be rendered by kid and then passed to an
> instance of TurboMail.Message

> the template is rendered correctly, but when passing it to the
> message, i receive encoding errors.
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 67: ordinal not in range(128).

> what can i do about that? i think i´m using the latest version of
> turbomail 2.0.3

Showing us the code would help. I'm sending utf-8-encoded emails just fine
using TurboMail & don't have to tweak the systems default encoding.

Diez


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johnny Blonde  
View profile
 More options May 4 2007, 6:45 am
From: Johnny Blonde <frank.wagner.1...@googlemail.com>
Date: Fri, 04 May 2007 10:45:44 -0000
Local: Fri, May 4 2007 6:45 am
Subject: Re: TurboMail and unicode problem
this is actually the code:
http://paste.turbogears.org/paste/1256

nothing special i think...?

On 4 Mai, 10:56, "Diez B. Roggisch" <diez.roggi...@artnology.com>
wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Diez B. Roggisch  
View profile
 More options May 4 2007, 8:07 am
From: "Diez B. Roggisch" <diez.roggi...@artnology.com>
Date: Fri, 4 May 2007 14:07:43 +0200
Local: Fri, May 4 2007 8:07 am
Subject: Re: [TurboGears] Re: TurboMail and unicode problem
On Friday 04 May 2007 12:45, Johnny Blonde wrote:

> this is actually the code:
> http://paste.turbogears.org/paste/1256

> nothing special i think...?

Well, apart from you not passing the subject and the rendered not as
unicode-objects, but as byte-strings of course.

Which will result in the byte-string being encoded to a unicode object with
the standard encoding - ascii.

And of course that fails.

I do it like this:

message.rich = unicode(kid_engine.render(params,
template='varms.templates.sales.groupvisits_email'), 'utf-8')

Diez


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johnny Blonde  
View profile
 More options May 7 2007, 5:21 am
From: Johnny Blonde <frank.wagner.1...@googlemail.com>
Date: Mon, 07 May 2007 09:21:28 -0000
Local: Mon, May 7 2007 5:21 am
Subject: Re: TurboMail and unicode problem
thanks a lot diez,

that works perfectly.

Frank

On 4 Mai, 14:07, "Diez B. Roggisch" <diez.roggi...@artnology.com>
wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google