subtitletools.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:plugin.video.streamondemand-pureita 作者: orione7 项目源码 文件源码
def _normalize(title,charset = 'utf-8'):
    '''Removes all accents and illegal chars for titles from the String'''
    if isinstance(title,unicode):
        title = string.translate(title,allchars,deletechars)
        try:
            title = title.encode("utf-8")
            title = normalize('NFKD',title ).encode('ASCII','ignore')
        except UnicodeEncodeError:
            logger.info("Error de encoding")
    else:
        title = string.translate(title,allchars,deletechars)
        try:
            #iso-8859-1
            title =   title.decode(charset).encode('utf-8')
            title =  normalize('NFKD', unicode(title,'utf-8'))
            title =  title.encode('ASCII','ignore')
        except UnicodeEncodeError:
            logger.info("Error de encoding")
    return title

    #
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号