[Yum-devel] [PATCH] clean up misc.to_xml(), make it faster, add tests. BZ 716235.
Zdenek Pavlas
zpavlas at redhat.com
Mon Nov 19 09:36:12 UTC 2012
> $ python -c "import yum.misc; print yum.misc.to_xml('Skytt\xe4')"
> Skyttä
>
> After this patch:
>
> $ python -c "import yum.misc; print yum.misc.to_xml('Skytt\xe4')"
> Skytt�
>
> That'd be a regression in my opinion.
I see, and agree.
# check if valid utf8
try: unicode(item, 'utf-8')
except UnicodeDecodeError:
- # replace invalid bytes with \ufffd
- item = unicode(item, 'utf-8', 'replace').encode('utf-8')
+ # assume iso-8859-1
+ item = unicode(item, 'iso-8859-1').encode('utf-8')
elif type(item) is unicode:
item = item.encode('utf-8')
elif item is None:
More information about the Yum-devel
mailing list