mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-02 01:08:20 +00:00
Respect the provided encoding
UTF-8 is great but if we're claiming the encoding is something else everywhere else we can't just make it UTF-8 here.
This commit is contained in:
parent
56f141e170
commit
f4432d3f23
@ -101,11 +101,11 @@ def run_cli_unicode(verb, argv, nodeargs=None, stdin=None, encoding=None):
|
||||
argv=argv,
|
||||
)
|
||||
d = run_cli_bytes(
|
||||
verb.encode("utf-8"),
|
||||
nodeargs=list(arg.encode("utf-8") for arg in nodeargs),
|
||||
verb.encode(encoding),
|
||||
nodeargs=list(arg.encode(encoding) for arg in nodeargs),
|
||||
stdin=stdin,
|
||||
encoding=encoding,
|
||||
*list(arg.encode("utf-8") for arg in argv)
|
||||
*list(arg.encode(encoding) for arg in argv)
|
||||
)
|
||||
def maybe_decode(result):
|
||||
code, stdout, stderr = result
|
||||
|
@ -259,7 +259,7 @@ def quote_output_u(*args, **kwargs):
|
||||
result = quote_output(*args, **kwargs)
|
||||
if isinstance(result, unicode):
|
||||
return result
|
||||
return result.decode("utf-8")
|
||||
return result.decode(kwargs.get("encoding", None) or io_encoding)
|
||||
|
||||
|
||||
def quote_output(s, quotemarks=True, quote_newlines=None, encoding=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user