mirror of
https://github.com/intari/search2_chatgpt.git
synced 2025-09-01 10:09:36 +00:00
22 lines
No EOL
697 B
Python
22 lines
No EOL
697 B
Python
import os
|
||
import chardet
|
||
|
||
DIRECTORY = "./" # Замени на путь к папке с файлами
|
||
|
||
def detect_encoding(filename):
|
||
with open(filename, "rb") as f:
|
||
raw_data = f.read()
|
||
result = chardet.detect(raw_data)
|
||
return result["encoding"]
|
||
|
||
def check_all_files(directory):
|
||
for root, _, files in os.walk(directory):
|
||
for file in files:
|
||
filepath = os.path.join(root, file)
|
||
encoding = detect_encoding(filepath)
|
||
if encoding and "utf-16" in encoding.lower():
|
||
print(f"❌ {filepath} - {encoding}")
|
||
|
||
print("🔍 Поиск файлов с UTF-16...")
|
||
check_all_files(DIRECTORY)
|
||
print("✅ Готово!") |