def _handle_nopinyin_char(chars, errors='default'): """处理没有拼音的字符""" if callable_check(errors): return errors(chars) if errors == 'default': return chars elif errors == 'ignore': return None elif errors == 'replace': if len(chars) > 1: return ''.join(text_type('%x' % ord(x)) for x in chars) else: return text_type('%x' % ord(chars))
def _handle_nopinyin_char(chars, errors='default'): """处理没有拼音的字符""" if callable_check(errors): return errors(chars) if errors == 'default': return chars elif errors == 'ignore': return None elif errors == 'replace': if len(chars) > 1: return ''.join(text_type('%x' % ord(x)) for x in chars) else: return text_type('%x' % ord(chars))
def _convert_nopinyin_chars(self, chars, style, heteronym, errors, strict): """转换没有拼音的字符。 """ if callable_check(errors): return errors(chars) if errors == 'default': return chars elif errors == 'ignore': return None elif errors == 'replace': if len(chars) > 1: return ''.join(text_type('%x' % ord(x)) for x in chars) else: return text_type('%x' % ord(chars))