Handle non-utf8 unicode without raising an error.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
67dc90ec0e
commit
26c7dd3712
3 changed files with 18 additions and 2 deletions
|
|
@ -457,7 +457,7 @@ def parse_environment(environment):
|
|||
|
||||
def split_env(env):
|
||||
if isinstance(env, six.binary_type):
|
||||
env = env.decode('utf-8')
|
||||
env = env.decode('utf-8', 'replace')
|
||||
if '=' in env:
|
||||
return env.split('=', 1)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ def stream_as_text(stream):
|
|||
"""
|
||||
for data in stream:
|
||||
if not isinstance(data, six.text_type):
|
||||
data = data.decode('utf-8')
|
||||
data = data.decode('utf-8', 'replace')
|
||||
yield data
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue