[Rpm-metadata] createrepo/utils.py
Luke Macken
lmacken at redhat.com
Thu Apr 17 17:17:24 UTC 2008
On Wed, Apr 16, 2008 at 12:33:14PM -0400, James Antill wrote:
> On Wed, 2008-04-16 at 12:16 -0400, Luke Macken wrote:
>
> > Ok, so it looks like we're losing here.
> >
> > This utf8String method seems to be a bit misleading, and full of pain. I assume we
> > want to give it a utf-8 encoded string, and get back a unicode object, right?
>
> See my later patch, that is probably less mis-leading?
>
> In the caller, that we are having problems with, we want to give it a
> str() from RPM (which may or may not be utf8) and get a valid utf8 str()
> object back _that is also valid inside an XML document_ (excepting
> random < > & bytes, which get converted).
Ah, I see. Ok then, my examples are assuming the method wanted to
return a "unicoded" string, like the docstring says. Since this is not
the case, my examples are not valid. (Although, if we were handling
unicode properly within the program they would be. Ideally we should be
decoding (str->unicode) early, and encoding (unicode->str) late. It
seems like here we are never decoding, and encoding all of the freaking
time. Pain and suffering ensues :)
After discussion on IRC, I agree with Toshio and find his solution to be
the sanest.
luke
More information about the Rpm-metadata
mailing list