mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 16:36:20 +00:00
cli: decode all cli arguments, assuming that they are utf-8 encoded
Also encode all args to urllib as utf-8 because urllib doesn't handle unicode objects. I'm not sure if it is appropriate to *assume* utf-8 encoding of cli args. Perhaps the Right thing to do is to detect the platform encoding. Any ideas? This patch is mostly due to François Deppierraz.
This commit is contained in:
parent
ce5effbedf
commit
36df38e58b
@ -129,4 +129,4 @@ def get_alias(aliases, path, default):
|
||||
|
||||
def escape_path(path):
|
||||
segments = path.split("/")
|
||||
return "/".join([urllib.quote(s) for s in segments])
|
||||
return "/".join([urllib.quote(s.encode('utf-8')) for s in segments])
|
||||
|
@ -33,6 +33,12 @@ def runner(argv,
|
||||
stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr,
|
||||
install_node_control=True, additional_commands=None):
|
||||
|
||||
# Convert arguments to unicode
|
||||
new_argv = []
|
||||
for arg in argv:
|
||||
new_argv.append(arg.decode('utf-8'))
|
||||
argv = new_argv
|
||||
|
||||
config = Options()
|
||||
if install_node_control:
|
||||
config.subCommands.extend(startstop_node.subCommands)
|
||||
|
Loading…
x
Reference in New Issue
Block a user