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.
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])
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)