diff --git a/src/LunaTranslator/myutils/utils.py b/src/LunaTranslator/myutils/utils.py index a25f139a..e6fcb50b 100644 --- a/src/LunaTranslator/myutils/utils.py +++ b/src/LunaTranslator/myutils/utils.py @@ -384,33 +384,6 @@ def selectdebugfile(path: str, ismypost=False): return p -def checkchaos(text): - code = globalconfig["accept_encoding"] - - text = filter(lambda x: x not in globalconfig["accept_character"], text) - - if globalconfig["accept_use_unicode"]: - _start = globalconfig["accept_use_unicode_start"] - _end = globalconfig["accept_use_unicode_end"] - chaos = False - for ucode in map(lambda x: ord(x), text): - print(ucode, _start, _end) - if ucode < _start or ucode > _end: - chaos = True - break - else: - chaos = True - text = "".join(text) - for c in code: - try: - text.encode(c) - chaos = False - break - except: - pass - return chaos - - def checkencoding(code): try: @@ -1065,3 +1038,23 @@ def is_ascii_symbo(c: str): def is_ascii_control(c: str): return cinranges(c, (0, 0x1F), (0x7F, 0xA0)) + + + +def checkchaos(text): + code = globalconfig["accept_encoding"] + text = filter(lambda x: x not in globalconfig["accept_character"], text) + + if globalconfig["accept_use_unicode"]: + _start = globalconfig["accept_use_unicode_start"] + _end = globalconfig["accept_use_unicode_end"] + return not all(cinranges(c,(_start, _end)) for c in text) + else: + text = "".join(text) + for c in code: + try: + text.encode(c) + return False + except: + pass + return True diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index cd54141f..76da6922 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 53) -set(VERSION_PATCH 7) +set(VERSION_PATCH 8) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)