# Buggy code
def sorted_service_list():
    """Returns an list of subliminal providers (it's not sorted, but the order matters!)

    Each item in the list is a dict containing:
        name: str: provider name
        url: str: provider url
        image: str: provider image
        enabled: bool: whether the provider is enabled or not

    :return: a list of subliminal providers.
    :rtype: list of dict
    """
    new_list = []
    lmgtfy = "http://lmgtfy.com/?q=%s"

    current_index = 0
    for current_service in sickbeard.SUBTITLES_SERVICES_LIST:
        if current_service in provider_manager.names():
            new_list.append(
                {
                    "name": current_service,
                    "url": PROVIDER_URLS[current_service]
                    if current_service in PROVIDER_URLS
                    else lmgtfy % current_service,
                    "image": current_service + ".png",
                    "enabled": sickbeard.SUBTITLES_SERVICES_ENABLED[current_index] == 1,
                }
            )
        current_index += 1

    for current_service in provider_manager.names():
        if current_service not in [service["name"] for service in new_list]:
            new_list.append(
                {
                    "name": current_service,
                    "url": PROVIDER_URLS[current_service]
                    if current_service in PROVIDER_URLS
                    else lmgtfy % current_service,
                    "image": current_service + ".png",
                    "enabled": False,
                }
            )
    return new_list


# Traceback (UnicodeEncodeError)
FINDSUBTITLES :: [d47493d] Traceback (most recent call last):
File "/home/home/SickRage/sickbeard/subtitles.py", line 338, in download_best_subs
save_subtitles(video, found_subtitles, directory=subtitles_dir, single=not sickbeard.SUBTITLES_MULTI)
File "/home/home/SickRage/lib/subliminal/core.py", line 695, in save_subtitles
with io.open(subtitle_path, 'wb') as f:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xea' in position 93: ordinal not in range(128)
Traceback (most recent call last):
File "/home/home/SickRage/sickbeard/subtitles.py", line 338, in download_best_subs
save_subtitles(video, found_subtitles, directory=subtitles_dir, single=not sickbeard.SUBTITLES_MULTI)
File "/home/home/SickRage/lib/subliminal/core.py", line 695, in save_subtitles
with io.open(subtitle_path, 'wb') as f:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xea' in position 93: ordinal not in range(128)

# Fixed code
def sorted_service_list():
    """Return an list of subliminal providers (it's not sorted, but the order matters!).

    Each item in the list is a dict containing:
        name: str: provider name
        url: str: provider url
        image: str: provider image
        enabled: bool: whether the provider is enabled or not

    :return: a list of subliminal providers.
    :rtype: list of dict
    """
    new_list = []
    lmgtfy = "http://lmgtfy.com/?q=%s"

    current_index = 0
    for current_service in sickbeard.SUBTITLES_SERVICES_LIST:
        if current_service in provider_manager.names():
            new_list.append(
                {
                    "name": current_service,
                    "url": PROVIDER_URLS[current_service]
                    if current_service in PROVIDER_URLS
                    else lmgtfy % current_service,
                    "image": current_service + ".png",
                    "enabled": sickbeard.SUBTITLES_SERVICES_ENABLED[current_index] == 1,
                }
            )
        current_index += 1

    for current_service in provider_manager.names():
        if current_service not in [service["name"] for service in new_list]:
            new_list.append(
                {
                    "name": current_service,
                    "url": PROVIDER_URLS[current_service]
                    if current_service in PROVIDER_URLS
                    else lmgtfy % current_service,
                    "image": current_service + ".png",
                    "enabled": False,
                }
            )
    return new_list