23 lines
792 B
Python
23 lines
792 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Search UEWingman source files for non-ASCII characters."""
|
||
|
|
|
||
|
|
import os
|
||
|
|
import glob
|
||
|
|
|
||
|
|
source_dir = "Plugins/UEWingman/Source"
|
||
|
|
patterns = ["**/*.cpp", "**/*.h"]
|
||
|
|
found_any = False
|
||
|
|
|
||
|
|
for pattern in patterns:
|
||
|
|
for filepath in sorted(glob.glob(os.path.join(source_dir, pattern), recursive=True)):
|
||
|
|
with open(filepath, "r", encoding="utf-8") as f:
|
||
|
|
for lineno, line in enumerate(f, 1):
|
||
|
|
for col, ch in enumerate(line, 1):
|
||
|
|
if ord(ch) > 127:
|
||
|
|
if not found_any:
|
||
|
|
found_any = True
|
||
|
|
print(f"{filepath}:{lineno}:{col} U+{ord(ch):04X} {ch!r} ...{line[max(0,col-10):col+10].rstrip()}...")
|
||
|
|
|
||
|
|
if not found_any:
|
||
|
|
print("No non-ASCII characters found.")
|