# Buggy code
def _create_arguments(self):
    if self.namedpipe:
        filename = self.namedpipe.path
    elif self.filename:
        filename = self.filename
    elif self.http:
        filename = self.http.url
    else:
        filename = "-"
    extra_args = []

    if self.title is not None:
        # vlc
        if self.player_name == "vlc":
            # see https://wiki.videolan.org/Documentation:Format_String/, allow escaping with \$
            self.title = self.title.replace("$", "$$").replace(r"\$$", "$")
            extra_args.extend(["--input-title-format", self.title])

        # mpv
        if self.player_name == "mpv":
            # see https://mpv.io/manual/stable/#property-expansion, allow escaping with \$, respect mpv's $>
            self.title = self._mpv_title_escape(self.title)
            extra_args.append("--title={}".format(self.title))

        # potplayer
        if self.player_name == "potplayer":
            if filename != "-":
                # PotPlayer - About - Command Line
                # You can specify titles for URLs by separating them with a backslash (\) at the end of URLs.
                # eg. "http://...\title of this url"
                self.title = self.title.replace('"', "")
                filename = filename[:-1] + "\\" + self.title + filename[-1]

    args = self.args.format(filename=filename)
    cmd = self.cmd

    # player command
    if is_win32:
        eargs = maybe_decode(subprocess.list2cmdline(extra_args))
        # do not insert and extra " " when there are no extra_args
        return maybe_encode(
            " ".join([cmd] + ([eargs] if eargs else []) + [args]),
            encoding=get_filesystem_encoding(),
        )
    return shlex.split(cmd) + extra_args + shlex.split(args)


# Traceback (UnicodeDecodeError)
OS: macOS 10.14.2
Python: 2.7.14
Streamlink: 1.1.1
Requests(2.21.0), Socks(1.6.7), Websocket(0.47.0)
Found matching plugin twitch for URL twitch.tv/quickybaby
Plugin specific arguments:
--twitch-oauth-token=******** (oauth_token)
--twitch-disable-hosting=True (disable_hosting)
--twitch-disable-ads=True (disable_ads)
Getting live HLS streams for quickybaby
Attempting to authenticate using OAuth token
Successfully logged in as DELETE
[utils.l10n][debug] Language code: en_US
Available streams: audio_only, 160p (worst), 360p, 480p, 720p, 720p60, 1080p60 (best)
Opening stream: 1080p60 (hls)
Starting player: /Applications/mpv.app/Contents/MacOS/mpv
Traceback (most recent call last):
File "/usr/local/bin/streamlink", line 11, in <module>
load_entry_point('streamlink==1.1.1', 'console_scripts', 'streamlink')()
File "/usr/local/lib/python2.7/site-packages/streamlink-1.1.1-py2.7.egg/streamlink_cli/main.py", line 1033, in main
handle_url()
File "/usr/local/lib/python2.7/site-packages/streamlink-1.1.1-py2.7.egg/streamlink_cli/main.py", line 594, in handle_url
handle_stream(plugin, streams, stream_name)
File "/usr/local/lib/python2.7/site-packages/streamlink-1.1.1-py2.7.egg/streamlink_cli/main.py", line 437, in handle_stream
success = output_stream_passthrough(plugin, stream)
File "/usr/local/lib/python2.7/site-packages/streamlink-1.1.1-py2.7.egg/streamlink_cli/main.py", line 262, in output_stream_passthrough
output.open()
File "/usr/local/lib/python2.7/site-packages/streamlink-1.1.1-py2.7.egg/streamlink_cli/output.py", line 24, in open
self._open()
File "/usr/local/lib/python2.7/site-packages/streamlink-1.1.1-py2.7.egg/streamlink_cli/output.py", line 219, in _open
self._open_call()
File "/usr/local/lib/python2.7/site-packages/streamlink-1.1.1-py2.7.egg/streamlink_cli/output.py", line 234, in _open_call
log.debug(u"Calling: {0}".format(fargs))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 141: ordinal not in range(128)

# Fixed code
def _create_arguments(self):
    if self.namedpipe:
        filename = self.namedpipe.path
    elif self.filename:
        filename = self.filename
    elif self.http:
        filename = self.http.url
    else:
        filename = "-"
    extra_args = []

    if self.title is not None:
        # vlc
        if self.player_name == "vlc":
            # see https://wiki.videolan.org/Documentation:Format_String/, allow escaping with \$
            self.title = self.title.replace("$", "$$").replace(r"\$$", "$")
            extra_args.extend(["--input-title-format", self.title])

        # mpv
        if self.player_name == "mpv":
            # see https://mpv.io/manual/stable/#property-expansion, allow escaping with \$, respect mpv's $>
            self.title = self._mpv_title_escape(self.title)
            extra_args.append("--title={}".format(self.title))

        # potplayer
        if self.player_name == "potplayer":
            if filename != "-":
                # PotPlayer - About - Command Line
                # You can specify titles for URLs by separating them with a backslash (\) at the end of URLs.
                # eg. "http://...\title of this url"
                self.title = self.title.replace('"', "")
                filename = filename[:-1] + "\\" + self.title + filename[-1]

    args = self.args.format(filename=filename)
    cmd = self.cmd

    # player command
    if is_win32:
        eargs = maybe_decode(subprocess.list2cmdline(extra_args))
        # do not insert and extra " " when there are no extra_args
        return " ".join([cmd] + ([eargs] if eargs else []) + [args])
    return shlex.split(cmd) + extra_args + shlex.split(args)