mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
fix
This commit is contained in:
parent
b40186a3d2
commit
377024ff26
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user