import locale


def prepare_string(input_string):
    """
    Make a string save for printing in a terminal. The string get recoded using the terminals preferred locale and
    replacing the characters that cannot be encoded.
    :param input_string: the input string
    :return: the output string which is save for printing
    """
    return '{t}'.format(t=input_string.encode(locale.getpreferredencoding(), errors='replace').decode())