Re: Internationalised email subjects

2007-06-25 Thread bugmagnet
I'm an idiot! Gabriel, you're right! Turns out the ISP was running Python 2.3, which has known issues with the GB2312 codec. They've upgraded to 2.4 and now everything runs smoothly! -- http://mail.python.org/mailman/listinfo/python-list

Re: Internationalised email subjects

2007-06-22 Thread Gabriel Genellina
En Fri, 22 Jun 2007 06:49:22 -0300, <[EMAIL PROTECTED]> escribió: > I've tried removing the encode('GB2312') line, so the code looks like > this: > > h = Header(subject, 'GB2312') > > However, this line still causes the following error message: > > Traceback (most recent call last): > File "/home/

Re: Internationalised email subjects

2007-06-22 Thread bugmagnet
Thanks Richie, I've tried removing the encode('GB2312') line, so the code looks like this: h = Header(subject, 'GB2312') However, this line still causes the following error message: Traceback (most recent call last): File "/home/web88/html/app/sendmail.py", line 314, in h = Header(subject, 'GB2

Re: Internationalised email subjects

2007-06-22 Thread bugmagnet
Thanks Martin, The "Some Chinese characters" are loaded from a MySQL table and are encoded in GB2312 format. I've added the following line at the top of the code: # -*- coding: GB2312 -*- I've also added the following line into the code: h = Header(subject.encode('GB2312'), 'GB2312') Note tha

Re: Internationalised email subjects

2007-06-21 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > That's really strange. The chinese characters I am inputing into the > post are not being displayed. Basically, what I am doing is this: > > h = Header('(Some Chinese characters inserted here', 'GB2312') What encoding do "Some Chinese characters" have at that point?

Re: Google breaks international charset messages (was: Internationalised email subjects)

2007-06-21 Thread Evan Klitzke
On 6/21/07, Ben Finney <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > > Seems some characters are missing from my last post. The line that > > says: > > > > h = Header(' ', 'GB2312') > > > > should say: > > > > h = Header(' ', 'GB2312') > > Your message has this field in the header:

Google breaks international charset messages (was: Internationalised email subjects)

2007-06-21 Thread Ben Finney
[EMAIL PROTECTED] writes: > Seems some characters are missing from my last post. The line that > says: > > h = Header(' ', 'GB2312') > > should say: > > h = Header(' ', 'GB2312') Your message has this field in the header: Content-Type: text/plain; charset="us-ascii" which is why the non-

Re: Internationalised email subjects

2007-06-21 Thread Evan Klitzke
On 6/21/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > That's really strange. The chinese characters I am inputing into the > post are not being displayed. Basically, what I am doing is this: You're not sending your email in UTF-8 (or another encoding that would permit Chinese characters). Y

Re: Internationalised email subjects

2007-06-21 Thread Gabriel Genellina
En Thu, 21 Jun 2007 06:23:43 -0300, <[EMAIL PROTECTED]> escribió: > That's really strange. The chinese characters I am inputing into the > post are not being displayed. Basically, what I am doing is this: > > h = Header('(Some Chinese characters inserted here', 'GB2312') > > And when I run this

Re: Internationalised email subjects

2007-06-21 Thread bugmagnet
That's really strange. The chinese characters I am inputing into the post are not being displayed. Basically, what I am doing is this: h = Header('(Some Chinese characters inserted here', 'GB2312') And when I run this code, I receive the following error message: UnicodeDecodeError: 'gb2312' co

Re: Internationalised email subjects

2007-06-21 Thread bugmagnet
Seems some characters are missing from my last post. The line that says: h = Header(' ', 'GB2312') should say: h = Header(' ', 'GB2312') -- http://mail.python.org/mailman/listinfo/python-list

Re: Internationalised email subjects

2007-06-20 Thread bugmagnet
Thanks Martin, I actually have read that page before. The part that confuses me is the line: h = Header('p\xf6stal', 'iso-8859-1') I have tried using: h = Header(' ', 'GB2312') but when I run the code, I get the following error: UnicodeDecodeError: 'gb2312' codec can't decode bytes in positi

Re: Internationalised email subjects

2007-06-20 Thread Martin Skou
From: http://docs.python.org/lib/module-email.header.html >>> from email.message import Message >>> from email.header import Header >>> msg = Message() >>> h = Header('p\xf6stal', 'iso-8859-1') >>> msg['Subject'] = h >>> print msg.as_string() Subject: =?iso-8859-1?q?p=F6stal?= /Martin -- h

Internationalised email subjects

2007-06-20 Thread bugmagnet
I am writing a simple email program in Python that will send out emails containing Chinese characters in the message subject and body. I am not having any trouble getting the email body displayed correctly in Chinese inside the email client, however the email subject and sender name (which are also