Thread Previous • Date Previous • Date Next • Thread Next |
On 04/19/2010 10:36 AM, Karl Fogel wrote:
Maris Fogels<maris.fogels@xxxxxxxxxxxxx> writes:Danilo, I have a fix for this here: lp:~mars/launchpad/fix-ec2-email-encodingMaris, this makes me wonder: do we have a policy on where encoding of strings happens? Some projects state that all strings beyond a certain boundary in the API will be in UTF-8 (or whatever). Your fix is great, but this seems like the sort of bug that will bite us again. I don't see anything in the dev wiki about it, and don't recall any such guideline from conversations about Launchpad coding. Is there one, or if not, should there be? -Karl
I do not know of any policy. I just used the Python rule of thumb: encoding and decoding happens at the boundaries; Use unicode objects in between. I agree that this could be a problem in the future though.
I think the code structure is the issue here. There are .encode() lines scattered throughout the module. My preferred solution in this case would be to extract a SubmitOptions object to hold the mail-related options. I would add a write_option_to_file() method to the object that would be the single point for binary encoding to take place.
Maris
Thread Previous • Date Previous • Date Next • Thread Next |