Files
kis_trader/scratch/fix_surrogates.py

13 lines
500 B
Python

with open("scratch/restore_backtest_safe.py", "r", encoding="utf-8") as f:
text = f.read()
# Replace surrogate pairs with actual characters or proper escapes
# \ud83c\udfc6 -> 🏆
text = text.replace(r"\ud83c\udfc6", "🏆")
# We also have \ube44 (비), \uad50 (교) etc, but those are just normal BMP characters,
# but they might be encoded as surrogates? No, BMP is fine.
with open("scratch/restore_backtest_safe.py", "w", encoding="utf-8") as f:
f.write(text)
print("Fixed surrogates")