def decode_text(text):
    """Decode a given text string to an Unicode string.

    If `text` can't be decoded to a common encoding, it will be decoded to UTF-8
    passing the "replace" options.
    """
    for enc in ('utf-8', 'iso-8859-15', 'iso-8859-1', 'ascii'):
        try:
            return text.decode(enc)
        except UnicodeDecodeError:
            continue
    # fallback
    return text.decode('utf-8', 'replace')