Not sure if its helpful, but didn't see any other reply, so anyway:

Change in [1] assumes Unicode Sandwich [5] where the given content is assumed to be already encoded into utf-8 string (unicode object in py2, str object in py3, six.text_type for both py versions) and then encoded back into utf-8 bytes when its time to write it back. In your case the certificate contents was read as plain str in python 2 which is by default assumed to have ASCII encoding, so the top bread slice of the sandwich was missing and it got the jam spilling (exception).

Line of [1] is mostly for sake of python 3, where we cannot treat bytes and strs the same any more since default encoding for py3 strs is unicode and not ascii like py2. So if you remove [1] you'll probably make some problems for py3 (like comparing bytes with strings, TypeErrors, etc).

[5] https://stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte


On Tue, Jul 23, 2019 at 1:21 PM Yedidyah Bar David <didi@redhat.com> wrote:
Hi Nir and all,

In [1] you added line 151, to encode the contents to utf-8. Do you
remember why you needed that? What happens if I remove this line?

I am working on [2]. It fails on that line, because the current
content, if organization name is unicode, has a UTF-8 encoded string
already, but is a python str (not unicode). Tried patching otopi [3],
did a few attempts (some of them also pushed there, check the
different patchsets), but none worked. So I am going to patch
postinstall file generation instead [4], but I don't like this.

Any hints are welcome. Thanks and best regards,

[1] https://gerrit.ovirt.org/#/c/92435/1/src/otopi/filetransaction.py

[2] https://bugzilla.redhat.com/show_bug.cgi?id=1729511

[3] https://gerrit.ovirt.org/102085

[4] https://gerrit.ovirt.org/102089
--
Didi
_______________________________________________
Devel mailing list -- devel@ovirt.org
To unsubscribe send an email to devel-leave@ovirt.org
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/
List Archives: https://lists.ovirt.org/archives/list/devel@ovirt.org/message/3JZCK5POIBNEDIF2I7ABDD3VNOLZOUK3/