Re: help with unicode email parse

2006-09-08 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, neoedmund wrote: > john , you can look my code: > it downloads email and save to local filesystem(filename and email > contains non-english characters) > it works now. > but i still think python's unicode string is not as straightforward as > java's > string SHOULD always b

Re: help with unicode email parse

2006-09-07 Thread neoedmund
john , you can look my code: it downloads email and save to local filesystem(filename and email contains non-english characters) it works now. but i still think python's unicode string is not as straightforward as java's string SHOULD always be unicode. or i'm trouble dealing them when they are in

Re: help with unicode email parse

2006-09-07 Thread John Machin
neoedmund wrote: [top-posting corrected] > John Machin wrote: > > neoedmund wrote: > > > i want to get the subject from email and construct a filename with the > > > subject. > > > but tried a lot, always got error like this: > > > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in positi

Re: help with unicode email parse

2006-09-07 Thread neoedmund
thank you John and Diez. i found fn = "%s/%s-%s.mail"%("d:/mail", "12345", '\xe6\xb5\x8b\xe8\xaf\x95' ) is ok fn = "%s/%s-%s.mail"%(u"d:/mail", "12345", '\xe6\xb5\x8b\xe8\xaf\x95' ) results: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128) So "str"%(

Re: help with unicode email parse

2006-09-07 Thread John Machin
neoedmund wrote: > i want to get the subject from email and construct a filename with the > subject. > but tried a lot, always got error like this: > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 4: > ordinal not in range(128) > > > msg = email.message_from_string( text

Re: help with unicode email parse

2006-09-07 Thread Diez B. Roggisch
neoedmund schrieb: > i want to get the subject from email and construct a filename with the > subject. > but tried a lot, always got error like this: > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 4: > ordinal not in range(128) > > > msg = email.message_from_string(

help with unicode email parse

2006-09-07 Thread neoedmund
i want to get the subject from email and construct a filename with the subject. but tried a lot, always got error like this: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 4: ordinal not in range(128) msg = email.message_from_string( text ) title = decode_hea