修复bug
This commit is contained in:
24
check_encodings.py
Normal file
24
check_encodings.py
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
import os
|
||||
|
||||
def check_encoding(directory):
|
||||
for root, dirs, files in os.walk(directory):
|
||||
for file in files:
|
||||
if file.endswith('.uvue') or file.endswith('.uts'):
|
||||
filepath = os.path.join(root, file)
|
||||
try:
|
||||
with open(filepath, 'rb') as f:
|
||||
raw = f.read()
|
||||
|
||||
# Check for BOM
|
||||
if raw.startswith(b'\xef\xbb\xbf'):
|
||||
print(f"BOM detected: {filepath}")
|
||||
|
||||
# Try decoding as UTF-8
|
||||
raw.decode('utf-8')
|
||||
|
||||
except Exception as e:
|
||||
print(f"Potential encoding error or mojibake in: {filepath}")
|
||||
|
||||
check_encoding(r'd:\骅锋\mall\pages\mall\admin')
|
||||
check_encoding(r'd:\骅锋\mall\layouts')
|
||||
Reference in New Issue
Block a user