Change in vdsm[master]: startup: Change system default encoding to utf8

mzamazal at redhat.com mzamazal at redhat.com
Wed Nov 18 10:03:35 UTC 2015


Milan Zamazal has posted comments on this change.

Change subject: startup: Change system default encoding to utf8
......................................................................


Patch Set 4: Code-Review+1

(3 comments)

I made some checks and it seems this patch indeed solves the string/unicode troubles we currently have.

https://gerrit.ovirt.org/#/c/48661/4//COMMIT_MSG
Commit Message:

Line 5: CommitDate: 2015-11-17 15:57:54 +0200
Line 6: 
Line 7: startup: Change system default encoding to utf8
Line 8: 
Line 9: In Python 2, the system default encoding is 'ascii'. This cause mixing
... causes ...
Line 10: of unicode and non-ascii strings (e.g. utf8 encoded) to fail with
Line 11: UnicodeDecodeError or UnicodeEncodeError. The trigger for this failures
Line 12: is starting using the built-in json library, that return all values as
Line 13: unicode strings, even if the value is ascii.


Line 8: 
Line 9: In Python 2, the system default encoding is 'ascii'. This cause mixing
Line 10: of unicode and non-ascii strings (e.g. utf8 encoded) to fail with
Line 11: UnicodeDecodeError or UnicodeEncodeError. The trigger for this failures
Line 12: is starting using the built-in json library, that return all values as
... returns ...
Line 13: unicode strings, even if the value is ascii.
Line 14: 
Line 15: For example:
Line 16: 


Line 19:   File "<stdin>", line 1, in <module>
Line 20: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 0: ordinal
Line 21: not in range(128)
Line 22: 
Line 23: Python tries to decode the second value implicitly, and fail since this
... fails ...
Line 24: is a utf8 encoded string.
Line 25: 
Line 26: To avoid such issues, the entire application must be changed to use only
Line 27: strings or only unicode internally, and never mix these types.  In the


-- 
To view, visit https://gerrit.ovirt.org/48661
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Icc3f072a499ba4034bdbedd09eb60d7a3a32f9c8
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Milan Zamazal <mzamazal at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list