Juan Hernandez has uploaded a new change for review. Change subject: cli: Use UTF-8 for writing output files ......................................................................
cli: Use UTF-8 for writing output files Currently when the CLI opens an output file due to a redirection it opens it using the ASCII character encoding. If the text written to the file contains characters outside of the ASCII set an exception is generated. This patch changes the CLI so that it uses UTF-8 when writing these files. Change-Id: Ibe4eae82d3360c678cba133106e4a30ab930ca3b Bug-Url: https://bugzilla.redhat.com/1126763 Signed-off-by: Juan Hernandez <[email protected]> --- M src/cli/context.py 1 file changed, 2 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/61/31661/1 diff --git a/src/cli/context.py b/src/cli/context.py index cd1fa44..aac6553 100644 --- a/src/cli/context.py +++ b/src/cli/context.py @@ -454,9 +454,9 @@ elif type_ == '<<': self.terminal.stdin = StringIO(arg) elif type_ == '>': - self.terminal.stdout = file(arg, 'w') + self.terminal.stdout = codecs.open(arg, 'w', 'utf8') elif type_ == '>>': - self.terminal.stdout = file(arg, 'a') + self.terminal.stdout = codecs.open(arg, 'a', 'utf8') def _restore_io_streams(self): """INTERNAL: reset IO streams.""" -- To view, visit http://gerrit.ovirt.org/31661 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibe4eae82d3360c678cba133106e4a30ab930ca3b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
