From 9aa62bd92b1fc1920ba24f0d81c410524279714d Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 28 Nov 2014 15:03:04 -0500 Subject: [PATCH] Fix dockerfile parsing for unicode --- util/dockerfileparse.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/dockerfileparse.py b/util/dockerfileparse.py index f8e8631f8..4dde4b0e6 100644 --- a/util/dockerfileparse.py +++ b/util/dockerfileparse.py @@ -79,8 +79,8 @@ def parse_dockerfile(contents): for line in lines: match_command = COMMAND_REGEX.match(line) if match_command: - command = match_command.group(1).upper() - parameters = match_command.group(2) + command = match_command.group(1).decode('utf-8').upper() + parameters = match_command.group(2).decode('utf-8') commands.append({ 'command': command, @@ -91,5 +91,6 @@ def parse_dockerfile(contents): def serialize_dockerfile(parsed_dockerfile): - return '\n'.join([' '.join([command['command'], command['parameters']]) + return '\n'.join([' '.join([command['command'].encode('utf-8'), + command['parameters'].encode('utf-8')]) for command in parsed_dockerfile.commands])