[MERGE][#139318] bzr send @ win32: ensure that command line to invoking Thunderbird is 8-bit string, not unicode (because subprocess does not understand non-ascii unicode)

Alexander Belchenko bialix at ukr.net
Tue Feb 26 14:02:58 GMT 2008


Aaron Bentley пишет:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Alexander Belchenko wrote:
>> This patch fixes problem with UnicodeEncodeError and subprocess module @
>> win32.
> 
> According to my tests, both the encoded and unicode forms are allowed on
> Linux.  So we can encode on all platforms, which should give your change
> better test coverage.
> 
> Also, please include a test case.

I don't understand how to test this issue. It's very specific issue
related to behavior of standard subprocess.py module on Windows,
that in turn depend on msvcrt.dll library. What kind of test you're
have in mind?

> 
> bb:resubmit
> 
>> Actually I need this fix only for Thunderbird, default MapiClient is not
>> affected
>> by unicode bug. So if someone think that subject.encode(user_encdoing,
>> 'replace')
>> should be only in Thunderbird class, I'll move it there.
> 
> Actually, it looks like we need to encode all arguments that may be
> provided, so I think the right place would be in
> ExternalMailClient._compose, doing
> 
> cmdline = [a.encode(user_encoding, 'replace') for a in cmdline]
> 
> If you do it there, it's pretty hard to test, so I wouldn't require it.

I think it's better place for encoding, because I need to convert URL
to attachment to plain string too. I'd like to rework my patch according
to your suggestion.




More information about the bazaar mailing list