完善页面细节
This commit is contained in:
38
final_admin_check.py
Normal file
38
final_admin_check.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
|
||||
root_dir = r'pages/mall/admin'
|
||||
extensions = ('.uvue', '.uts', '.vue', '.json', '.js', '.ts', '.scss', '.md', '.txt', '.ps1', '.bat', '.sh')
|
||||
|
||||
print(f"Checking every text file in {os.path.abspath(root_dir)} recursively...")
|
||||
|
||||
found_count = 0
|
||||
for root, dirs, files in os.walk(root_dir):
|
||||
for file in files:
|
||||
if file.lower().endswith(extensions):
|
||||
path = os.path.join(root, file)
|
||||
try:
|
||||
with open(path, 'rb') as f:
|
||||
data = f.read()
|
||||
|
||||
# Try UTF-8
|
||||
try:
|
||||
data.decode('utf-8')
|
||||
# If success, skip
|
||||
continue
|
||||
except UnicodeDecodeError:
|
||||
# Non-UTF8!
|
||||
try:
|
||||
data.decode('gbk')
|
||||
enc = 'GBK'
|
||||
except:
|
||||
enc = 'Other non-UTF8'
|
||||
print(f"{enc:<20} | {os.path.abspath(path)}")
|
||||
found_count += 1
|
||||
except Exception as e:
|
||||
# print(f"Error {path}: {e}")
|
||||
pass
|
||||
|
||||
if found_count == 0:
|
||||
print("All scanned files are valid UTF-8.")
|
||||
else:
|
||||
print(f"\nFound {found_count} non-UTF-8 files.")
|
||||
Reference in New Issue
Block a user