1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-23 06:31:30 +02:00

Move force_uniceode to utils package

This commit is contained in:
2020-11-11 19:30:50 +01:00
parent 35c34c3b45
commit 3152c52839
16 changed files with 72 additions and 60 deletions
+4 -4
View File
@@ -8,9 +8,9 @@ import re
import sys
import urllib.parse
from ebook_converter import force_unicode
from ebook_converter.utils.config_base import tweaks
from ebook_converter.polyglot.urllib import unquote
from ebook_converter.utils import encoding as uenc
try:
@@ -43,7 +43,7 @@ def remove_bracketed_text(src, brackets=None):
from collections import Counter
counts = Counter()
buf = []
src = force_unicode(src)
src = uenc.force_unicode(src)
rmap = {v: k for k, v in brackets.items()}
for char in src:
if char in brackets:
@@ -75,7 +75,7 @@ def author_to_author_sort(author, method=None):
if method == 'copy':
return author
prefixes = {force_unicode(y).lower()
prefixes = {uenc.force_unicode(y).lower()
for y in tweaks['author_name_prefixes']}
prefixes |= {y+'.' for y in prefixes}
while True:
@@ -87,7 +87,7 @@ def author_to_author_sort(author, method=None):
else:
break
suffixes = {force_unicode(y).lower()
suffixes = {uenc.force_unicode(y).lower()
for y in tweaks['author_name_suffixes']}
suffixes |= {y+'.' for y in suffixes}