INNER CODE UNIT · Python

safestr

siznax/wptools · wptools/core.py:311

def safestr(text):
    """
    Safely convert unicode to a string
    """
    if text is None:
        return
    try:
        return str(text)
    except UnicodeEncodeError:
        return str(text.encode('utf-8'))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…