[PATCH] Fallback to common charsets when charset is None or x-unknown

Jeremy Kerr jk at ozlabs.org
Fri Jul 4 10:47:01 EST 2014


Hi Siddesh,

>> We recently encountered a case in our glibc patchwork instance on
>> sourceware, where a patch was dropped because it had x-unknown
>> charset.  I used the following patch to fix this in our instance.  The
>> fix I used was to fall back on a set of encodings (instead of just
>> utf-8) when the charset is not mentioned or if it is set as x-unknown.
>>
>> I hope this is useful.  I'd love to know if you all think there is a
>> better way to fix this so that I can implement that in our instance
>> instead of my hack.

Just one thing I noticed when applying this:

> +
> +            # If there is no charset or if it is unknown, then try some common
> +            # charsets before we fail.
> +            if charset is None or charset == 'x-unknown':
> +                try_charsets = ['utf-8', 'windows-1252', 'ascii', 'iso-8859-1']

Is there any point including ascii there? If it didn't parse as utf-8, I 
don't think it'll parse as ascii either.

Also, could you send me a Signed-off-by line for this patch too?

Regards,


Jeremy


More information about the Patchwork mailing list