[Yum-devel] [PATCH] when writing out the config data in add_on - do the to_unicode() bit so we don't trace out rh bug https://bugzilla.redhat.com/show_bug.cgi?id=622301
James Antill
james at fedoraproject.org
Mon Aug 9 14:20:35 UTC 2010
On Mon, 2010-08-09 at 10:12 -0400, Seth Vidal wrote:
> ---
> yum/history.py | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/yum/history.py b/yum/history.py
> index 502b908..66861c8 100644
> --- a/yum/history.py
> +++ b/yum/history.py
> @@ -610,7 +610,7 @@ class YumHistory:
> # open file in append
> fo = open(data_fn, 'w+')
> # write data
> - fo.write(data)
> + fo.write(to_unicode(data))
> # flush data
> fo.flush()
> fo.close()
Have you tested that with random utf-8 crack in the config? ACK if you
have.
I'd have thought you wanted "to_utf8()" ... or to change the open()
call like:
fo = codes.open(data_fn, "w+", "utf-8")
...or even utf-8-sig! Personally I think the to_utf8() is probably more
obvious for us mortals, but I guess the later is the best practice, or
something.
http://stackoverflow.com/questions/934160/write-to-utf-8-file-in-python
etc.
More information about the Yum-devel
mailing list