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

Siddhesh Poyarekar siddhesh at redhat.com
Fri Jul 4 12:21:45 EST 2014


On Fri, Jul 04, 2014 at 08:47:01AM +0800, Jeremy Kerr wrote:
> 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.

Right, it won't.  I'll remove it.

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

Sure, I'll send an updated patch shortly.

Siddhesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20140704/f6f757cf/attachment.sig>


More information about the Patchwork mailing list