def filesystem_encode(u):
    fsencoding = sys.getfilesystemencoding()
    if ((fsencoding.lower() in ['ascii', 'ansi_x3.4-1968']) and sys.platform.startswith('linux')):
        fsencoding = 'utf-8'
    return u.encode(fsencoding, filesystem_errors)
def filesystem_encode(u):
    fsencoding = sys.getfilesystemencoding()
    if ((fsencoding.lower() in ['ascii', 'ansi_x3.4-1968']) and sys.platform.startswith('linux')):
        fsencoding = 'utf-8'
    return u.encode(fsencoding, filesystem_errors)