def _nix_bad_emoticons(text): """Remove troublesome emoticons so, e.g., '(128)' renders properly. By default (at least in 'text' mode), '8)' is replaced by a sunglasses-head emoticon. There is no way to send sunglasses-head using alertlib. This is a feature. """ return text.replace(u'8)', u'8\u200b)') # zero-width space
def translate_line_breaks(text): """Convert any EOL style to Linux EOL.""" text = text.replace("\r\n", "\n") return text.replace("\r", "\n")