[PATCH] patchbomb: Encode overly long lines

Martin Geisler mg at lazybytes.net
Fri May 8 18:29:24 CDT 2009


Rocco Rutte <pdmef at gmx.net> writes:

>> So it should be fine to pass 'us-ascii' as a charset. With that in
>> mind, I think this should be equivalent to your patch:
>
> Yes it is and it works and I find it slightly more readable.

Cool -- I've pushed it to crew as revision 3e544c074459. Thank you for
the patch and especially for the tests!

>> I tried analyzing the cases and came to the conclussion that the
>> charset is set to 'utf-8' if and only if we're not displaying the
>> patch, we're not able to decode with 'us-ascii' and we are able to
>> decode with 'utf-8'. Like this, except that it doesn't work due to
>> the exceptions:
>
>>     if not display and not s.decode('us-ascii') and s.decode('utf-8'):
>>         cs = 'utf-8'
>>     else:
>>         cs = 'us-ascii'
>
>> Do you think that looks okay?
>
> Yes. I'll see if I can produce some tests to verify the various cases
> with non-ascii and broken utf-8 plus combinations of these.

Sounds good -- thanks!

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20090509/c3cd507d/attachment.pgp 


More information about the Mercurial-devel mailing list